You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2016/06/30 19:23:06 UTC

[01/26] incubator-geode git commit: Removing flaky test label from tests with fixed bugs.

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1571 b43d0266d -> b37f43932


Removing flaky test label from tests with fixed bugs.


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

Branch: refs/heads/feature/GEODE-1571
Commit: 49d144bb2cf731d4c62fc86715fd8c9e0a680d45
Parents: 7ad9cc9
Author: Dan Smith <up...@apache.org>
Authored: Tue Jun 21 18:22:51 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Mon Jun 27 11:58:04 2016 -0700

----------------------------------------------------------------------
 .../java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java   | 2 --
 .../cache/client/internal/pooling/ConnectionManagerJUnitTest.java  | 2 --
 .../gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java         | 2 --
 .../com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java    | 2 --
 .../java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java    | 2 --
 .../distributed/internal/LocatorLoadSnapshotIntegrationTest.java   | 2 --
 .../ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java         | 1 -
 .../gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java   | 2 --
 .../management/UniversalMembershipListenerAdapterDUnitTest.java    | 2 --
 .../gemfire/cache/query/cq/dunit/CqPerfUsingPoolDUnitTest.java     | 2 --
 .../management/internal/cli/commands/ClientCommandsDUnitTest.java  | 1 -
 .../gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java   | 2 --
 .../com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java     | 2 --
 .../gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java   | 1 -
 .../ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java       | 2 --
 15 files changed, 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
index 3ae6cf6..fef2171 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
@@ -72,7 +72,6 @@ import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 /**
  * This class tests the client connection pool in GemFire.
@@ -1180,7 +1179,6 @@ public class ConnectionPoolDUnitTest extends JUnit4CacheTestCase {
    * Make sure cnx lifetime expiration working on thread local cnxs.
    * @author darrel
    */
-  @Category(FlakyTest.class) // GEODE-1197: random ports, BindException, FixMethodOrder, expiration, time sensitive, waitForCriterion, async actions
   @Test
   public void test009LifetimeExpireOnTL() throws CacheException {
     basicTestLifetimeExpire(true);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java
index 28a5342..861569e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/pooling/ConnectionManagerJUnitTest.java
@@ -31,7 +31,6 @@ import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.test.dunit.ThreadUtils;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import org.junit.After;
 import org.junit.Assert;
@@ -219,7 +218,6 @@ public class ConnectionManagerJUnitTest {
 //    
 //  }
 
-  @Category(FlakyTest.class) // GEODE-923: time sensitive, expiration, thread sleeps, wait loop
   @Test
   public void testIdleExpiration() throws InterruptedException, AllConnectionsInUseException, NoAvailableServersException {
     final long nanoToMillis = 1000000;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
index 4672a94..0d844db 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
@@ -66,7 +66,6 @@ import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
 
@@ -1025,7 +1024,6 @@ public class QueryUsingPoolDUnitTest extends JUnit4CacheTestCase {
   /**
    * Tests client-server query using parameters (compiled queries).
    */
-  @Category(FlakyTest.class) // GEODE-1146: time senstiive, thread sleeps, uses zero port for servers (good!), async actions, AsyncInvocation orphans
   @Test
   public void testBindParamsWithMulitipleClients() throws CacheException {
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
index dc6af7a..39ae008 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
@@ -67,7 +67,6 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.LOCATORS;
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.MCAST_PORT;
@@ -743,7 +742,6 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
    * server joins when the client connects to the server. If the server
    * crashes or departs gracefully, the client will detect this as a crash.
    */
-  @Category(FlakyTest.class) // GEODE-1240: eats exceptions, random ports, time sensitive waits
   @Test
   public void testClientMembershipEventsInClient() throws Exception {
     getSystem();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
index 197a665..5e68b9e 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
@@ -47,7 +47,6 @@ import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.internal.tcp.Connection;
 import com.gemstone.gemfire.test.dunit.*;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 import java.io.File;
 import java.io.IOException;
@@ -1438,7 +1437,6 @@ public class LocatorDUnitTest extends JUnit4DistributedTestCase {
    * end up only have 1 master.
    * GEODE-870
    */
-  @Category(FlakyTest.class) // GEODE-1150: random ports, disk pollution, waitForCriterion, time sensitive, eats exceptions (fixed several)
   @Test
   public void testMultipleLocatorsRestartingAtSameTime() throws Exception {
     disconnectAllFromDS();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotIntegrationTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotIntegrationTest.java
index 08648d9..8b9f5f6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotIntegrationTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LocatorLoadSnapshotIntegrationTest.java
@@ -28,7 +28,6 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.server.ServerLoad;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
 /**
@@ -43,7 +42,6 @@ public class LocatorLoadSnapshotIntegrationTest {
    * three servers.
    * @throws InterruptedException
    */
-  @Category(FlakyTest.class) // GEODE-613: lots of threads, async action, IntegrationTest-not-UnitTest, thread joins, time sensitive
   @Test
   public void testConcurrentBalancing() throws InterruptedException {
     int NUM_THREADS = 50;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
index 5aaa124..5e645fa 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/ScheduledThreadPoolExecutorWithKeepAliveJUnitTest.java
@@ -178,7 +178,6 @@ public class ScheduledThreadPoolExecutorWithKeepAliveJUnitTest {
         TimeUnit.SECONDS.toNanos(10) <= end - start + SLOP); 
   }
 
-  @Category(FlakyTest.class) // GEODE-710: time sensitive, async actions, 5 second thread sleeps
   @Test
   public void testRepeatedExecution() throws InterruptedException {
     ex = new ScheduledThreadPoolExecutorWithKeepAlive(

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
index ffcca1c..e611086 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
@@ -54,7 +54,6 @@ import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 @Category(DistributedTest.class)
 public class SingleHopStatsDUnitTest extends JUnit4CacheTestCase {
@@ -119,7 +118,6 @@ public class SingleHopStatsDUnitTest extends JUnit4CacheTestCase {
     }
   }
 
-  @Category(FlakyTest.class) // GEODE-364: random ports, time sensitive, waitForCriterions, magic numbers (113, 226)
   @Test
   public void testClientStatsPR() {
     Integer port0 = (Integer) member0.invoke(() -> createServerForStats(0, 113, "No_Colocation"));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
index 5457ed3..91a6188 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/UniversalMembershipListenerAdapterDUnitTest.java
@@ -61,7 +61,6 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 /**
  * Tests the UniversalMembershipListenerAdapter.
@@ -714,7 +713,6 @@ public class UniversalMembershipListenerAdapterDUnitTest extends ClientServerTes
   /**
    * Tests notification of events for loner bridge clients in server process.
    */
-  @Category(FlakyTest.class) // GEODE-1174: random port, async behavior, condition await loops
   @Test
   public void testSystemClientEventsInServer() throws Exception {
     try {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqPerfUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqPerfUsingPoolDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqPerfUsingPoolDUnitTest.java
index 0168419..413230c 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqPerfUsingPoolDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqPerfUsingPoolDUnitTest.java
@@ -54,7 +54,6 @@ import com.gemstone.gemfire.test.dunit.NetworkUtils;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 /**
  * This class tests the ContiunousQuery mechanism in GemFire.
@@ -412,7 +411,6 @@ public class CqPerfUsingPoolDUnitTest extends JUnit4CacheTestCase {
    * To test the changes relating to, executing CQ only once for all similar CQs.
    * @throws Exception
    */
-  @Category(FlakyTest.class) // GEODE-988: random ports, time sensitive, waitForCriterion, 20 second timeouts
   @Test
   public void testMatchingCqs() throws Exception {
     

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
index 5947883..4ff4a16 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java
@@ -925,7 +925,6 @@ public class ClientCommandsDUnitTest extends CliCommandTestBase {
 
   }
 
-  @Category(FlakyTest.class) // GEODE-1227: HeadlessGFSH, random ports, BindException
   @Test
   public void testDescribeMixClientWithServers() throws Exception {
     String[] clientIds = setupSystemWithSubAndNonSubClient();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
index 12fdea8..bdba7d7 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java
@@ -29,7 +29,6 @@ import com.gemstone.gemfire.security.generator.DummyAuthzCredentialGenerator;
 import com.gemstone.gemfire.security.generator.DummyCredentialGenerator;
 import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -74,7 +73,6 @@ public class ClientAuthzObjectModDUnitTest extends ClientAuthorizationTestCase {
     server2.invoke("registerInstantiator", () -> Instantiator.register(new MyInstantiator(), false));
   }
 
-  @Category(FlakyTest.class) // GEODE-1228: random ports, BindException, uses Random
   @Test
   public void testAllOpsObjectModWithFailover() throws Exception {
     OperationWithAction[] allOps = allOps();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java
index b827ae6..3dfbfe9 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/cache/CacheXml70GatewayDUnitTest.java
@@ -50,7 +50,6 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
 import com.gemstone.gemfire.internal.cache.xmlcache.ParallelGatewaySenderCreation;
 import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
 import com.gemstone.gemfire.internal.cache.xmlcache.SerialGatewaySenderCreation;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 @Category(DistributedTest.class)
 public class CacheXml70GatewayDUnitTest extends CacheXmlTestCase {
@@ -101,7 +100,6 @@ public class CacheXml70GatewayDUnitTest extends CacheXmlTestCase {
     }
   }
 
-  @Category(FlakyTest.class) // GEODE-978: hardcoded port range, BindException
   @Test
   public void testGatewayReceiver() throws Exception{
     getSystem();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java
index 64b1906..24b3a40 100755
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/CacheClientNotifierDUnitTest.java
@@ -165,7 +165,6 @@ public class CacheClientNotifierDUnitTest extends WANTestBase {
    * The test will start several cache servers, including gateway receivers.
    * Shutdown them and verify the CacheClientNotifier for each server is correct
    */
-  @Category(FlakyTest.class) // GEODE-1183: random ports, failure to start threads, eats exceptions, time sensitive
   @Test
   public void testNormalClient2MultipleCacheServer() throws Exception {
     doMultipleCacheServer(false);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d144bb/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
index 443d592..855856e 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderDUnitTest.java
@@ -40,7 +40,6 @@ import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
-import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 @Category(DistributedTest.class)
 public class ParallelWANPersistenceEnabledGatewaySenderDUnitTest extends WANTestBase {
@@ -463,7 +462,6 @@ public class ParallelWANPersistenceEnabledGatewaySenderDUnitTest extends WANTest
    * Dispatcher should not start dispatching events recovered from persistent sender.
    * Check if the remote site receives all the events.
    */
-  @Category(FlakyTest.class) // GEODE-1124: random ports, time sensitive, waitForCriterion, async behavior
   @Test
   public void testPersistentPRWithGatewaySenderPersistenceEnabled_Restart2() {
     //create locator on local site


[22/26] incubator-geode git commit: GEODE-1571: post process for get, query, cq and register interest.

Posted by ji...@apache.org.
GEODE-1571: post process for get, query, cq and register interest.


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

Branch: refs/heads/feature/GEODE-1571
Commit: 39c56843bdaa67f0df4dbbb9edc096e8cb4e12e6
Parents: beb50ad
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Jun 30 11:58:42 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Jun 30 11:58:42 2016 -0700

----------------------------------------------------------------------
 .../cache/tier/sockets/BaseCommandQuery.java    |  28 +++++
 .../cache/tier/sockets/CacheClientNotifier.java |  29 ++---
 .../cache/tier/sockets/CacheClientProxy.java    | 110 ++++++++++++++----
 .../cache/tier/sockets/ClientUserAuths.java     |   6 -
 .../cache/tier/sockets/ServerConnection.java    |   9 --
 .../internal/security/GeodeSecurityUtil.java    |   3 +-
 .../gemfire/security/PostProcessor.java         |   2 +-
 .../security/templates/SamplePostProcessor.java |   4 +-
 ...CacheServerMBeanAuthenticationJUnitTest.java |   9 +-
 .../JsonAuthorizationCacheStartRule.java        |  16 +--
 ...ractIntegratedClientAuthDistributedTest.java |   4 +
 ...tegratedClientGetPutAuthDistributedTest.java |  32 ++---
 ...urityNoShowValue1PostProcessorDUnitTest.java |  84 ++++++++++++++
 ...ntegratedSecurityPostProcessorDUnitTest.java | 116 +++++++++++++++++++
 .../security/NoShowValue1PostProcessor.java     |  43 +++++++
 .../security/CQPostProcessorDunitTest.java      |  88 ++++++++++++++
 ...ntegratedClientQueryAuthDistributedTest.java |  25 +++-
 .../cli/commands/CommandOverHttpDUnitTest.java  |  17 +--
 18 files changed, 515 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
index 8a95cf8..3f79873 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/BaseCommandQuery.java
@@ -156,6 +156,34 @@ public abstract class BaseCommandQuery extends BaseCommand {
 
       if (result instanceof SelectResults) {
         SelectResults selectResults = (SelectResults)result;
+
+        // post process, iterate through the result for post processing
+        List list = selectResults.asList();
+        for(Iterator<Object> valItr = list.iterator(); valItr.hasNext();){
+          Object value = valItr.next();
+          Object newValue = value;
+          if(value instanceof CqEntry){
+            CqEntry cqEntry = (CqEntry)value;
+            Object cqNewValue = GeodeSecurityUtil.postProcess(null, cqEntry.getKey(), cqEntry.getValue());
+            if(!cqEntry.getValue().equals(cqNewValue)){
+              selectResults.remove(value);
+              if(cqNewValue!=null){
+                selectResults.add(new CqEntry(cqEntry.getKey(), cqNewValue));
+              }
+            }
+          }
+          else {
+            newValue = GeodeSecurityUtil.postProcess(null, null, value);
+            if(!value.equals(newValue)){
+              selectResults.remove(value);
+              // only add the newValue back if it's not null
+              if(newValue!=null){
+                selectResults.add(newValue);
+              }
+            }
+          }
+        }
+
         if (logger.isDebugEnabled()) {
           logger.debug("Query Result size for : {} is {}", query.getQueryString(), selectResults.size());
         }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientNotifier.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientNotifier.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientNotifier.java
index 11dc204..c5b742c 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientNotifier.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientNotifier.java
@@ -46,6 +46,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.logging.log4j.Logger;
+import org.apache.shiro.subject.Subject;
 
 import com.gemstone.gemfire.CancelException;
 import com.gemstone.gemfire.DataSerializer;
@@ -394,12 +395,14 @@ public class CacheClientNotifier {
               new IllegalArgumentException("Invalid conflation byte"), clientVersion);
           return;
       }
-      
+
+      proxy = registerClient(socket, proxyID, proxy, isPrimary, clientConflation,
+        clientVersion, acceptorId, notifyBySubscription);
       
       //TODO:hitesh
       Properties credentials = HandShake.readCredentials(dis, dos,
           authenticator, system);
-      if (credentials != null) {
+      if (credentials != null && proxy!=null) {
         if (securityLogWriter.fineEnabled()) {
           securityLogWriter.fine("CacheClientNotifier: verifying credentials for proxyID: " + proxyID);
         }
@@ -424,11 +427,14 @@ public class CacheClientNotifier {
             authzCallback = (AccessControl) authzMethod.invoke(null, (Object[]) null);
             authzCallback.init(principal, member, this.getCache());
           }
+          proxy.setPostAuthzCallback(authzCallback);
+        }
+        else if(subject instanceof Subject){
+          proxy.setSubject((Subject)subject);
         }
       }
     }
     catch (ClassNotFoundException e) {
-
       throw new IOException(LocalizedStrings.CacheClientNotifier_CLIENTPROXYMEMBERSHIPID_OBJECT_COULD_NOT_BE_CREATED_EXCEPTION_OCCURRED_WAS_0.toLocalizedString(e));
     }
     catch (AuthenticationRequiredException ex) {
@@ -441,24 +447,19 @@ public class CacheClientNotifier {
       writeException(dos, HandShake.REPLY_EXCEPTION_AUTHENTICATION_FAILED, ex, clientVersion);
       return;
     }
-    catch (Exception ex) {
-      logger.warn(LocalizedMessage.create(LocalizedStrings.CacheClientNotifier_AN_EXCEPTION_WAS_THROWN_FOR_CLIENT_0_1, new Object[] {proxyID, ""}), ex);
-      writeException(dos, Acceptor.UNSUCCESSFUL_SERVER_TO_CLIENT, ex, clientVersion);
-      return;
-    }
-    try {
-      proxy = registerClient(socket, proxyID, proxy, isPrimary, clientConflation,
-		  clientVersion, acceptorId, notifyBySubscription);
-    }
     catch (CacheException e) {
       logger.warn(LocalizedMessage.create(LocalizedStrings.CacheClientNotifier_0_REGISTERCLIENT_EXCEPTION_ENCOUNTERED_IN_REGISTRATION_1, new Object[] {this, e}), e);
       IOException io = new IOException(LocalizedStrings.CacheClientNotifier_EXCEPTION_OCCURRED_WHILE_TRYING_TO_REGISTER_INTEREST_DUE_TO_0.toLocalizedString(e.getMessage()));
       io.initCause(e);
       throw io;
     }
-    if (authzCallback != null && proxy != null) {
-      proxy.setPostAuthzCallback(authzCallback);
+    catch (Exception ex) {
+      logger.warn(LocalizedMessage.create(LocalizedStrings.CacheClientNotifier_AN_EXCEPTION_WAS_THROWN_FOR_CLIENT_0_1, new Object[] {proxyID, ""}), ex);
+      writeException(dos, Acceptor.UNSUCCESSFUL_SERVER_TO_CLIENT, ex, clientVersion);
+      return;
     }
+
+
     this._statistics.endClientRegistration(startTime);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
index c4b48f4..23b7bde 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientProxy.java
@@ -17,12 +17,55 @@
 
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.SocketException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.regex.Pattern;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.shiro.subject.Subject;
+import org.apache.shiro.util.ThreadState;
+
 import com.gemstone.gemfire.CancelException;
 import com.gemstone.gemfire.DataSerializer;
 import com.gemstone.gemfire.StatisticsFactory;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.ClientSession;
+import com.gemstone.gemfire.cache.DynamicRegionFactory;
+import com.gemstone.gemfire.cache.InterestRegistrationEvent;
+import com.gemstone.gemfire.cache.InterestResultPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.RegionExistsException;
 import com.gemstone.gemfire.cache.client.internal.RegisterInterestTracker;
-import com.gemstone.gemfire.cache.operations.*;
+import com.gemstone.gemfire.cache.operations.DestroyOperationContext;
+import com.gemstone.gemfire.cache.operations.InvalidateOperationContext;
+import com.gemstone.gemfire.cache.operations.OperationContext;
+import com.gemstone.gemfire.cache.operations.PutOperationContext;
+import com.gemstone.gemfire.cache.operations.RegionClearOperationContext;
+import com.gemstone.gemfire.cache.operations.RegionCreateOperationContext;
+import com.gemstone.gemfire.cache.operations.RegionDestroyOperationContext;
 import com.gemstone.gemfire.cache.query.CqException;
 import com.gemstone.gemfire.cache.query.internal.cq.CqService;
 import com.gemstone.gemfire.cache.query.internal.cq.InternalCqQuery;
@@ -34,8 +77,21 @@ import com.gemstone.gemfire.i18n.StringId;
 import com.gemstone.gemfire.internal.SystemTimer;
 import com.gemstone.gemfire.internal.SystemTimer.SystemTimerTask;
 import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.cache.*;
+import com.gemstone.gemfire.internal.cache.CacheDistributionAdvisee;
 import com.gemstone.gemfire.internal.cache.CacheDistributionAdvisor.InitialImageAdvice;
+import com.gemstone.gemfire.internal.cache.ClientServerObserver;
+import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
+import com.gemstone.gemfire.internal.cache.Conflatable;
+import com.gemstone.gemfire.internal.cache.DistributedRegion;
+import com.gemstone.gemfire.internal.cache.EntryEventImpl;
+import com.gemstone.gemfire.internal.cache.EnumListenerEvent;
+import com.gemstone.gemfire.internal.cache.EventID;
+import com.gemstone.gemfire.internal.cache.FilterProfile;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.InterestRegistrationEventImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.StateFlushOperation;
 import com.gemstone.gemfire.internal.cache.ha.HAContainerWrapper;
 import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
 import com.gemstone.gemfire.internal.cache.ha.HARegionQueueAttributes;
@@ -51,24 +107,8 @@ import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
 import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
 import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
+import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.AccessControl;
-import org.apache.logging.log4j.Logger;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.net.Socket;
-import java.net.SocketException;
-import java.nio.ByteBuffer;
-import java.util.*;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.regex.Pattern;
 
 /**
  * Class <code>CacheClientProxy</code> represents the server side of the
@@ -223,6 +263,7 @@ public class CacheClientProxy implements ClientSession {
   boolean keepalive = false;
 
   private AccessControl postAuthzCallback;
+  private Subject subject;
 
   /**
    * For multiuser environment..
@@ -362,6 +403,16 @@ public class CacheClientProxy implements ClientSession {
       this.postAuthzCallback = authzCallback;
     }
   }
+
+  public void setSubject(Subject subject) {
+    //TODO:hitesh synchronization
+    synchronized (this.clientUserAuthsLock) {
+      if (this.subject != null) {
+        subject.logout();
+      }
+      this.subject = subject;
+    }
+  }
   
   public void setCQVsUserAuth(String cqName, long uniqueId, boolean isDurable)
   {
@@ -1591,6 +1642,7 @@ public class CacheClientProxy implements ClientSession {
    */
   protected void deliverMessage(Conflatable conflatable)
   {
+    ThreadState state = GeodeSecurityUtil.bindSubject(this.subject);
     ClientUpdateMessage clientMessage = null;
     if(conflatable instanceof HAEventWrapper) {
       clientMessage = ((HAEventWrapper)conflatable).getClientUpdateMessage();
@@ -1600,6 +1652,21 @@ public class CacheClientProxy implements ClientSession {
 
     this._statistics.incMessagesReceived();
 
+    // post process
+    Object oldValue = clientMessage.getValue();
+    if(oldValue instanceof byte[]){
+      EntryEventImpl.deserialize((byte[])oldValue);
+      Object newValue = GeodeSecurityUtil.postProcess(clientMessage.getRegionName(),
+        clientMessage.getKeyOfInterest(),
+        EntryEventImpl.deserialize((byte[])oldValue));
+      clientMessage.setLatestValue(EntryEventImpl.serialize(newValue));
+    }
+    else{
+      Object newValue = GeodeSecurityUtil.postProcess(clientMessage.getRegionName(),
+        clientMessage.getKeyOfInterest(), oldValue);
+      clientMessage.setLatestValue(newValue);
+    }
+
     if (clientMessage.needsNoAuthorizationCheck() || postDeliverAuthCheckPassed(clientMessage)) {
       // If dispatcher is getting initialized, add the event to temporary queue.
       if (this.messageDispatcherInit) {
@@ -1625,6 +1692,9 @@ public class CacheClientProxy implements ClientSession {
     } else {
       this._statistics.incMessagesFailedQueued();
     }
+
+    if(state!=null)
+      state.clear();
   }
 
   protected void sendMessageDirectly(ClientMessage message) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientUserAuths.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientUserAuths.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientUserAuths.java
index 27f7fa8..8d24491 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientUserAuths.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientUserAuths.java
@@ -27,7 +27,6 @@ import org.apache.shiro.subject.Subject;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.security.AuthorizeRequest;
 import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
-import com.gemstone.gemfire.security.NotAuthorizedException;
 
 public class ClientUserAuths
 {
@@ -133,11 +132,6 @@ public class ClientUserAuths
         }
       }
     }
-    else
-    {
-      //TODO:throw not authorized exception? will this ever happen??
-      throw new NotAuthorizedException("User is not authorized for CQ");
-    }
   }
   
   public void removeUserAuthAttributesForCq(String cqName, boolean isDurable)

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
index 7c650b9..37c6034 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ServerConnection.java
@@ -630,15 +630,6 @@ public class ServerConnection implements Runnable {
     }
     return true;
   }
-
-//  public static AuthorizeRequestPP getPostAuthorizeCallback(ClientProxyMembershipID proxyId, String cqName)
-//  {
-//    ClientUserAuths cua = proxyIdVsClientUserAuths.get(proxyId);
-//    UserAuthAttributes uaa =  cua.getUserAuthAttributes(cqName);
-//    if (uaa != null)
-//      return uaa.getPostAuthzRequest();
-//    return null;
-//  }
   
   public void setCq(String cqName, boolean isDurable) throws Exception
   {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index 0ae3f7d..af1788a 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -343,7 +343,8 @@ public class GeodeSecurityUtil {
     if(subject == null)
       return result;
 
-    return postProcessor.processRegionValue((Principal)subject.getPrincipal(), regionPath, key,  result);
+    String regionName = StringUtils.stripStart(regionPath, "/");
+    return postProcessor.processRegionValue((Principal)subject.getPrincipal(), regionName, key,  result);
   }
 
   public static Object getObject(String factoryName) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/security/PostProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/PostProcessor.java b/geode-core/src/main/java/com/gemstone/gemfire/security/PostProcessor.java
index 7f959e9..1331081 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/PostProcessor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/PostProcessor.java
@@ -22,5 +22,5 @@ import java.util.Properties;
 
 public interface PostProcessor {
   void init(Properties securityProps);
-  Object processRegionValue(Principal principal, String regionPath, Object key,  Object value);
+  Object processRegionValue(Principal principal, String regionName, Object key,  Object value);
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
index 87a4e3c..8f13deb 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
@@ -36,9 +36,9 @@ public class SamplePostProcessor implements PostProcessor{
 
   @Override
   public Object processRegionValue(Principal principal,
-                                   String regionPath,
+                                   String regionName,
                                    Object key,
                                    Object value) {
-    return principal.getName()+"/"+regionPath+"/"+key+"/"+value;
+    return principal.getName()+"/"+regionName+"/"+key+"/"+value;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
index cf2a739..f38f2fc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/CacheServerMBeanAuthenticationJUnitTest.java
@@ -16,15 +16,16 @@
  */
 package com.gemstone.gemfire.management.internal.security;
 
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.management.CacheServerMXBean;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.management.CacheServerMXBean;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
 @Category(IntegrationTest.class)
 public class CacheServerMBeanAuthenticationJUnitTest {
   private static int jmxManagerPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -33,7 +34,7 @@ public class CacheServerMBeanAuthenticationJUnitTest {
 
   @ClassRule
   public static JsonAuthorizationCacheStartRule serverRule = new JsonAuthorizationCacheStartRule(
-      jmxManagerPort, "cacheServer.json", false);
+      jmxManagerPort, "cacheServer.json");
 
   @Rule
   public MBeanServerConnectionRule connectionRule = new MBeanServerConnectionRule(jmxManagerPort);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
index 4714016..00a9d7f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/JsonAuthorizationCacheStartRule.java
@@ -31,12 +31,10 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource {
   private int httpPort = 0;
   private String jsonFile;
   private Class postProcessor;
-  private boolean doAuthorization;
 
   public JsonAuthorizationCacheStartRule(int jmxManagerPort, String jsonFile, Class postProcessor) {
     this.jmxManagerPort = jmxManagerPort;
     this.jsonFile = jsonFile;
-    this.doAuthorization = true;
     this.postProcessor = postProcessor;
   }
 
@@ -44,20 +42,12 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource {
   public JsonAuthorizationCacheStartRule(int jmxManagerPort, String jsonFile) {
     this.jmxManagerPort = jmxManagerPort;
     this.jsonFile = jsonFile;
-    this.doAuthorization = true;
   }
 
   public JsonAuthorizationCacheStartRule(int jmxManagerPort, int httpPort, String jsonFile) {
     this.jmxManagerPort = jmxManagerPort;
     this.httpPort = httpPort;
     this.jsonFile = jsonFile;
-    this.doAuthorization = true;
-  }
-
-  public JsonAuthorizationCacheStartRule(int jmxManagerPort, String jsonFile, boolean doAuthorization) {
-    this.jmxManagerPort = jmxManagerPort;
-    this.jsonFile = jsonFile;
-    this.doAuthorization = doAuthorization;
   }
 
   protected void before() throws Throwable {
@@ -71,9 +61,7 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource {
     properties.put(HTTP_SERVICE_PORT, String.valueOf(httpPort));
     properties.put(SECURITY_CLIENT_AUTHENTICATOR,
         JSONAuthorization.class.getName() + ".create");
-    if (doAuthorization) {
-      properties.put(SECURITY_CLIENT_ACCESSOR, JSONAuthorization.class.getName() + ".create");
-    }
+
     if(postProcessor!=null){
       properties.put(SECURITY_CLIENT_ACCESSOR_PP, postProcessor.getName()+".create");
     }
@@ -82,8 +70,6 @@ public class JsonAuthorizationCacheStartRule extends ExternalResource {
 
     cache = new CacheFactory(properties).create();
     cache.addCacheServer().start();
-
-    cache.createRegionFactory().create("region1");
   }
 
   public Cache getCache(){

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
index a7ecb25..50d33ef 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
@@ -47,6 +47,7 @@ public class AbstractIntegratedClientAuthDistributedTest extends JUnit4CacheTest
   protected VM client2 = null;
   protected VM client3 = null;
   protected int serverPort;
+  protected Class postProcessor = null;
 
   @Before
   public void before() throws Exception{
@@ -59,6 +60,9 @@ public class AbstractIntegratedClientAuthDistributedTest extends JUnit4CacheTest
 
     Properties props = new Properties();
     props.setProperty(SECURITY_CLIENT_AUTHENTICATOR, JSONAuthorization.class.getName()+".create");
+    if(postProcessor!=null){
+      props.setProperty(SECURITY_CLIENT_ACCESSOR_PP, postProcessor.getName()+".create");
+    }
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
     props.setProperty(SECURITY_LOG_LEVEL, "finest");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
index 37f9e80..0630ecf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
@@ -24,16 +24,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
-import com.gemstone.gemfire.cache.client.ClientCacheFactory;
-import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 @Category(DistributedTest.class)
 public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
@@ -49,12 +47,8 @@ public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegrate
 
     // 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);
+      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");
@@ -72,12 +66,8 @@ public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegrate
 
     // 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);
+      ClientCache cache = createClientCache("authRegionUser", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
 
       region.put("key3", "value3");
       assertEquals("value3", region.get("key3"));
@@ -96,12 +86,8 @@ public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegrate
 
     // 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);
+      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");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java
new file mode 100644
index 0000000..98a62df
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityNoShowValue1PostProcessorDUnitTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.security;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.query.SelectResults;
+
+public class IntegratedSecurityNoShowValue1PostProcessorDUnitTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  public IntegratedSecurityNoShowValue1PostProcessorDUnitTest(){
+    this.postProcessor = NoShowValue1PostProcessor.class;
+  }
+
+  @Test
+  public void testPostProcess(){
+    List<String> keys = new ArrayList<>();
+    keys.add("key1");
+    keys.add("key2");
+
+    client1.invoke(()->{
+      ClientCache cache = createClientCache("super-user", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
+
+      // post process for get
+      assertEquals("value3", region.get("key3"));
+
+      assertNull(region.get("key1"));
+
+      // post processs for getAll
+      Map values = region.getAll(keys);
+      assertEquals(2, values.size());
+      assertEquals("value2", values.get("key2"));
+      assertNull(values.get("key1"));
+
+      // post process for query
+      String query = "select * from /AuthRegion";
+      SelectResults result = region.query(query);
+      System.out.println("query result: "+result);
+      assertEquals(4, result.size());
+      assertTrue(result.contains("value0"));
+      assertFalse(result.contains("value1"));
+      assertTrue(result.contains("value2"));
+      assertTrue(result.contains("value3"));
+      assertTrue(result.contains("value4"));
+
+      Pool pool = PoolManager.find(region);
+      result =  (SelectResults)pool.getQueryService().newQuery(query).execute();
+      System.out.println("query result: "+result);
+      assertTrue(result.contains("value0"));
+      assertFalse(result.contains("value1"));
+      assertTrue(result.contains("value2"));
+      assertTrue(result.contains("value3"));
+      assertTrue(result.contains("value4"));
+
+    });
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java
new file mode 100644
index 0000000..9f3e8b7
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedSecurityPostProcessorDUnitTest.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.security;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
+import com.gemstone.gemfire.security.templates.SamplePostProcessor;
+
+public class IntegratedSecurityPostProcessorDUnitTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  public IntegratedSecurityPostProcessorDUnitTest(){
+    this.postProcessor = SamplePostProcessor.class;
+  }
+
+  @Test
+  public void testPostProcess(){
+    List<String> keys = new ArrayList<>();
+    keys.add("key1");
+    keys.add("key2");
+
+    client1.invoke(()->{
+      ClientCache cache = createClientCache("super-user", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
+
+      // post process for get
+      Object value = region.get("key3");
+      assertEquals("super-user/AuthRegion/key3/value3", value);
+
+      // post processs for getAll
+      Map values = region.getAll(keys);
+      assertEquals(2, values.size());
+      assertEquals("super-user/AuthRegion/key1/value1", values.get("key1"));
+      assertEquals("super-user/AuthRegion/key2/value2", values.get("key2"));
+
+      // post process for query
+      String query = "select * from /AuthRegion";
+      SelectResults result = region.query(query);
+      assertEquals(5, result.size());
+
+      assertTrue(result.contains("super-user/null/null/value0"));
+      assertTrue(result.contains("super-user/null/null/value1"));
+      assertTrue(result.contains("super-user/null/null/value2"));
+      assertTrue(result.contains("super-user/null/null/value3"));
+      assertTrue(result.contains("super-user/null/null/value4"));
+
+      Pool pool = PoolManager.find(region);
+      result =  (SelectResults)pool.getQueryService().newQuery(query).execute();
+      assertTrue(result.contains("super-user/null/null/value0"));
+      assertTrue(result.contains("super-user/null/null/value1"));
+      assertTrue(result.contains("super-user/null/null/value2"));
+      assertTrue(result.contains("super-user/null/null/value3"));
+      assertTrue(result.contains("super-user/null/null/value4"));
+
+    });
+  }
+
+  @Test
+  public void testRegisterInterestPostProcess(){
+    client1.invoke(()->{
+      ClientCache cache = new ClientCacheFactory(createClientProperties("super-user", "1234567"))
+        .setPoolSubscriptionEnabled(true)
+        .addPoolServer("localhost", serverPort)
+        .create();
+
+      ClientRegionFactory factory =  cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
+      factory.addCacheListener(new CacheListenerAdapter() {
+        @Override
+        public void afterUpdate(EntryEvent event) {
+          assertEquals("super-user/AuthRegion/key1/value2", event.getSerializedNewValue().getDeserializedValue());
+        }
+      });
+
+      Region region = factory.create(REGION_NAME);
+      region.put("key1", "value1");
+      region.registerInterest("key1");
+    });
+
+    client2.invoke(()->{
+      ClientCache cache = createClientCache("dataUser", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
+      region.put("key1", "value2");
+    });
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java b/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java
new file mode 100644
index 0000000..bca9717
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/NoShowValue1PostProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.security;
+
+import java.security.Principal;
+import java.util.Properties;
+
+public class NoShowValue1PostProcessor implements PostProcessor {
+
+  public static NoShowValue1PostProcessor create(){
+    return new NoShowValue1PostProcessor();
+  }
+
+  @Override
+  public void init(final Properties securityProps) {
+  }
+
+  @Override
+  public Object processRegionValue(final Principal principal,
+                                   final String regionName,
+                                   final Object key,
+                                   final Object value) {
+    if(value.equals("value1"))
+      return null;
+    else
+      return value;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-cq/src/test/java/com/gemstone/gemfire/security/CQPostProcessorDunitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/CQPostProcessorDunitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/CQPostProcessorDunitTest.java
new file mode 100644
index 0000000..54f2e1a
--- /dev/null
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/CQPostProcessorDunitTest.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.security;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.PoolManager;
+import com.gemstone.gemfire.cache.query.CqAttributes;
+import com.gemstone.gemfire.cache.query.CqAttributesFactory;
+import com.gemstone.gemfire.cache.query.CqEvent;
+import com.gemstone.gemfire.cache.query.CqQuery;
+import com.gemstone.gemfire.cache.query.CqResults;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.internal.cq.CqListenerImpl;
+import com.gemstone.gemfire.security.templates.SamplePostProcessor;
+
+public class CQPostProcessorDunitTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  public CQPostProcessorDunitTest(){
+    this.postProcessor = SamplePostProcessor.class;
+  }
+
+  @Test
+  public void testPostProcess(){
+    String query = "select * from /AuthRegion";
+    client1.invoke(()-> {
+      ClientCache cache = createClientCache("super-user", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
+
+
+
+      Pool pool = PoolManager.find(region);
+      QueryService qs = pool.getQueryService();
+
+      CqAttributesFactory factory = new CqAttributesFactory();
+
+      factory.addCqListener(new CqListenerImpl() {
+        @Override
+        public void onEvent(final CqEvent aCqEvent) {
+          assertEquals("key6", aCqEvent.getKey());
+          assertEquals("super-user/AuthRegion/key6/value6", aCqEvent.getNewValue());
+        }
+      });
+
+
+      CqAttributes cqa = factory.create();
+
+      // Create the CqQuery
+      CqQuery cq = qs.newCq("CQ1", query, cqa);
+      CqResults results = cq.executeWithInitialResults();
+      assertEquals(5, results.size());
+      String resultString = results.toString();
+      assertTrue(resultString, resultString.contains("key:key0,value:super-user/null/key0/value0"));
+      assertTrue(resultString.contains("key:key1,value:super-user/null/key1/value1"));
+      assertTrue(resultString.contains("key:key2,value:super-user/null/key2/value2"));
+      assertTrue(resultString.contains("key:key3,value:super-user/null/key3/value3"));
+      assertTrue(resultString.contains("key:key4,value:super-user/null/key4/value4"));
+    });
+
+    client2.invoke(()-> {
+      ClientCache cache = createClientCache("authRegionUser", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
+      region.put("key6", "value6");
+    });
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
index ad219cf..0b22146 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
@@ -25,6 +25,8 @@ import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.query.CqAttributes;
 import com.gemstone.gemfire.cache.query.CqAttributesFactory;
+import com.gemstone.gemfire.cache.query.CqEvent;
+import com.gemstone.gemfire.cache.query.CqListener;
 import com.gemstone.gemfire.cache.query.CqQuery;
 import com.gemstone.gemfire.cache.query.QueryService;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
@@ -87,11 +89,30 @@ public class IntegratedClientQueryAuthDistributedTest extends AbstractIntegrated
       Pool pool = PoolManager.find(region);
       QueryService qs = pool.getQueryService();
 
-      CqAttributes cqa = new CqAttributesFactory().create();
+      CqAttributesFactory factory = new CqAttributesFactory();
+      factory.addCqListener(new CqListener() {
+        @Override
+        public void onEvent(final CqEvent aCqEvent) {
+          System.out.println(aCqEvent);
+        }
+
+        @Override
+        public void onError(final CqEvent aCqEvent) {
+
+        }
+
+        @Override
+        public void close() {
+
+        }
+      });
+
+
+      CqAttributes cqa = factory.create();
 
       // Create the CqQuery
       CqQuery cq = qs.newCq("CQ1", query, cqa);
-      cq.execute();
+      System.out.println("query result: "+cq.executeWithInitialResults());
 
       cq.stop();
     });

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39c56843/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
index 14a48c7..2f5348f 100644
--- a/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
+++ b/geode-web/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CommandOverHttpDUnitTest.java
@@ -16,25 +16,16 @@
  */
 package com.gemstone.gemfire.management.internal.cli.commands;
 
-import org.junit.experimental.categories.Category;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import com.gemstone.gemfire.test.junit.categories.SecurityTest;
-import com.gemstone.gemfire.test.junit.runner.SuiteRunner;
-
 import org.junit.ClassRule;
 import org.junit.contrib.java.lang.system.ProvideSystemProperty;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import com.gemstone.gemfire.test.junit.runner.SuiteRunner;
+
 @Category({ DistributedTest.class, SecurityTest.class })
 @RunWith(SuiteRunner.class)
 @Suite.SuiteClasses({


[14/26] incubator-geode git commit: Added ExecuteFunction test

Posted by ji...@apache.org.
Added ExecuteFunction test


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

Branch: refs/heads/feature/GEODE-1571
Commit: b782b6beccc4c04f5bd72b6c237d3ffe997b2eee
Parents: dbcdf33
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Tue Jun 28 13:27:53 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Tue Jun 28 13:27:53 2016 -0700

----------------------------------------------------------------------
 ...lientExecuteFunctionAuthDistributedTest.java | 60 ++++++++++++++++++++
 1 file changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b782b6be/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
new file mode 100644
index 0000000..089517a
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.security;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+import com.gemstone.gemfire.internal.cache.functions.TestFunction;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class IntegratedClientExecuteFunctionAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  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.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();
+    });
+  }
+}
+
+


[02/26] incubator-geode git commit: Alter permission to Cluster:Read for GetClientPartitionAttribute

Posted by ji...@apache.org.
Alter permission to Cluster:Read for GetClientPartitionAttribute


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

Branch: refs/heads/feature/GEODE-1571
Commit: 0f8694c3b0aec4950e21d198cca42ce9e7ec1925
Parents: 088e406
Author: gmeilen <gr...@gmail.com>
Authored: Mon Jun 27 14:22:01 2016 -0700
Committer: gmeilen <gr...@gmail.com>
Committed: Mon Jun 27 14:22:01 2016 -0700

----------------------------------------------------------------------
 .../GetClientPartitionAttributesCommand.java    | 137 +++++++-------
 .../GetClientPartitionAttributesCommand66.java  | 180 ++++++++++---------
 ...ientPartitionAttrCmdAuthDistributedTest.java |  61 +++++++
 3 files changed, 228 insertions(+), 150 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0f8694c3/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
index 204391d..0873635 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -34,12 +35,11 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
+
 /**
- * {@link Command} for {@link GetClientPartitionAttributesOp} operation 
- * 
- * 
+ * {@link Command} for {@link GetClientPartitionAttributesOp} operation
  * @since GemFire 6.5
- *
  */
 public class GetClientPartitionAttributesCommand extends BaseCommand {
 
@@ -55,7 +55,8 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
   @SuppressWarnings("unchecked")
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
-      throws IOException, ClassNotFoundException, InterruptedException {
+    throws IOException, ClassNotFoundException, InterruptedException
+  {
     String regionFullPath = null;
     CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     regionFullPath = msg.getPart(0).getString();
@@ -63,77 +64,81 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
     if (regionFullPath == null) {
       logger.warn(LocalizedMessage.create(LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL));
       errMessage = LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL
-          .toLocalizedString();
+        .toLocalizedString();
       writeErrorResponse(msg,
-          MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR, errMessage
-              .toString(), servConn);
+        MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR, errMessage
+          .toString(), servConn);
       servConn.setAsTrue(RESPONDED);
+      return;
     }
-    else {
-      Region region = crHelper.getRegion(regionFullPath);
-      if (region == null) {
-        logger.warn(LocalizedMessage.create(LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH, regionFullPath));
-        errMessage = LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND
-            .toLocalizedString()
-            + regionFullPath;
-        writeErrorResponse(msg,
-            MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR, errMessage
-                .toString(), servConn);
-        servConn.setAsTrue(RESPONDED);
+    Region region = crHelper.getRegion(regionFullPath);
+    if (region == null) {
+      logger.warn(LocalizedMessage
+        .create(LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH,
+          regionFullPath));
+      errMessage = LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND
+        .toLocalizedString()
+        + regionFullPath;
+      writeErrorResponse(msg,
+        MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR, errMessage
+          .toString(), servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
+    }
+
+    try {
+      GeodeSecurityUtil.authorizeClusterRead();
+      Message responseMsg = servConn.getResponseMessage();
+      responseMsg.setTransactionId(msg.getTransactionId());
+      responseMsg
+        .setMessageType(MessageType.RESPONSE_CLIENT_PARTITION_ATTRIBUTES);
+
+      PartitionedRegion prRgion = (PartitionedRegion) region;
+
+      PartitionResolver partitionResolver = prRgion.getPartitionResolver();
+      int numParts = 2; // MINUMUM PARTS
+      if (partitionResolver != null) {
+        numParts++;
       }
-      else {
-        try {
-          Message responseMsg = servConn.getResponseMessage();
-          responseMsg.setTransactionId(msg.getTransactionId());
-          responseMsg
-              .setMessageType(MessageType.RESPONSE_CLIENT_PARTITION_ATTRIBUTES);
+      responseMsg.setNumberOfParts(numParts);
+      // PART 1
+      responseMsg.addObjPart(prRgion.getTotalNumberOfBuckets());
 
-          PartitionedRegion prRgion = (PartitionedRegion)region;
+      // PART 2
+      if (partitionResolver != null) {
+        responseMsg.addObjPart(partitionResolver.getClass().toString()
+          .substring(6));
+      }
 
-          PartitionResolver partitionResolver = prRgion.getPartitionResolver();
-          int numParts = 2; // MINUMUM PARTS
-          if (partitionResolver != null) {
-            numParts++;
-          }
-          responseMsg.setNumberOfParts(numParts);
-          // PART 1
-          responseMsg.addObjPart(prRgion.getTotalNumberOfBuckets());
-          
-          // PART 2
-          if (partitionResolver != null) {
-            responseMsg.addObjPart(partitionResolver.getClass().toString()
-                .substring(6));
+      // PART 3
+      String leaderRegionPath = null;
+      PartitionedRegion leaderRegion = null;
+      String leaderRegionName = prRgion.getColocatedWith();
+      if (leaderRegionName != null) {
+        Cache cache = prRgion.getCache();
+        while (leaderRegionName != null) {
+          leaderRegion = (PartitionedRegion) cache
+            .getRegion(leaderRegionName);
+          if (leaderRegion.getColocatedWith() == null) {
+            leaderRegionPath = leaderRegion.getFullPath();
+            break;
           }
-          
-          // PART 3
-          String leaderRegionPath=null;
-          PartitionedRegion leaderRegion = null;
-          String leaderRegionName = prRgion.getColocatedWith();
-          if (leaderRegionName != null) {
-            Cache cache = prRgion.getCache();
-            while (leaderRegionName != null) {
-              leaderRegion = (PartitionedRegion)cache
-                  .getRegion(leaderRegionName);
-              if (leaderRegion.getColocatedWith() == null) {
-                leaderRegionPath=leaderRegion.getFullPath();
-                break;
-              } else {
-               leaderRegionName = leaderRegion.getColocatedWith();
-              }
-            }
+          else {
+            leaderRegionName = leaderRegion.getColocatedWith();
           }
-          responseMsg.addObjPart(leaderRegionPath);
-          responseMsg.send();
-          msg.clearParts();
-        }
-        catch (Exception e) {
-          writeException(msg, e, false, servConn);
-        }
-        finally {
-          servConn.setAsTrue(Command.RESPONDED);
         }
       }
+      responseMsg.addObjPart(leaderRegionPath);
+      responseMsg.send();
+      msg.clearParts();
+    }
+    catch (Exception e) {
+      writeException(msg, e, false, servConn);
+    }
+    finally {
+      servConn.setAsTrue(Command.RESPONDED);
     }
   }
-
 }
+
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0f8694c3/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
index 3eca123..72cdcf2 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
@@ -34,13 +35,12 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 
 /**
  * {@link Command} for {@link GetClientPartitionAttributesOp} operation for 6.6
  * clients
- * 
  * @since GemFire 6.6
- * 
  */
 public class GetClientPartitionAttributesCommand66 extends BaseCommand {
 
@@ -56,7 +56,8 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
   @SuppressWarnings("unchecked")
   @Override
   public void cmdExecute(Message msg, ServerConnection servConn, long start)
-      throws IOException, ClassNotFoundException, InterruptedException {
+    throws IOException, ClassNotFoundException, InterruptedException
+  {
     String regionFullPath = null;
     CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     regionFullPath = msg.getPart(0).getString();
@@ -64,95 +65,106 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
     if (regionFullPath == null) {
       logger.warn(LocalizedMessage.create(LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL));
       errMessage = LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL
-          .toLocalizedString();
+        .toLocalizedString();
       writeErrorResponse(msg,
-          MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
-          errMessage.toString(), servConn);
+        MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
+        errMessage.toString(), servConn);
       servConn.setAsTrue(RESPONDED);
-    } else {
-      Region region = crHelper.getRegion(regionFullPath);
-      if (region == null) {
-        logger.warn(LocalizedMessage.create(LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH, regionFullPath));
-        errMessage = LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND
-            .toLocalizedString() + regionFullPath;
-        writeErrorResponse(msg,
-            MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
-            errMessage.toString(), servConn);
-        servConn.setAsTrue(RESPONDED);
-      } else {
-        try {
-          Message responseMsg = servConn.getResponseMessage();
-          responseMsg.setTransactionId(msg.getTransactionId());
-          responseMsg
-              .setMessageType(MessageType.RESPONSE_CLIENT_PARTITION_ATTRIBUTES);
-
-          if (!(region instanceof PartitionedRegion)) {
-            responseMsg.setNumberOfParts(2);
-            responseMsg.addObjPart(-1);
-            responseMsg.addObjPart(region.getFullPath());
-          } else {
-
-            PartitionedRegion prRgion = (PartitionedRegion)region;
-
-            PartitionResolver partitionResolver = prRgion
-                .getPartitionResolver();
-            int numParts = 2; // MINUMUM PARTS
-            if (partitionResolver != null) {
-              numParts++;
-            }
-            if (prRgion.isFixedPartitionedRegion()) {
-              numParts++;
-            }
-            responseMsg.setNumberOfParts(numParts);
-            // PART 1
-            responseMsg.addObjPart(prRgion.getTotalNumberOfBuckets());
-
-            // PART 2
-            String leaderRegionPath = null;
-            PartitionedRegion leaderRegion = null;
-            String leaderRegionName = prRgion.getColocatedWith();
-            if (leaderRegionName != null) {
-              Cache cache = prRgion.getCache();
-              while (leaderRegionName != null) {
-                leaderRegion = (PartitionedRegion)cache
-                    .getRegion(leaderRegionName);
-                if (leaderRegion.getColocatedWith() == null) {
-                  leaderRegionPath = leaderRegion.getFullPath();
-                  break;
-                } else {
-                  leaderRegionName = leaderRegion.getColocatedWith();
-                }
-              }
-            }
-            responseMsg.addObjPart(leaderRegionPath);
+      return;
+    }
+    Region region = crHelper.getRegion(regionFullPath);
+    if (region == null) {
+      logger.warn(LocalizedMessage
+        .create(LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH,
+          regionFullPath));
+      errMessage = LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND
+        .toLocalizedString() + regionFullPath;
+      writeErrorResponse(msg,
+        MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
+        errMessage.toString(), servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
+    }
+
+    try {
+      GeodeSecurityUtil.authorizeClusterRead();
+      Message responseMsg = servConn.getResponseMessage();
+      responseMsg.setTransactionId(msg.getTransactionId());
+      responseMsg
+        .setMessageType(MessageType.RESPONSE_CLIENT_PARTITION_ATTRIBUTES);
+
+      if (!(region instanceof PartitionedRegion)) {
+        responseMsg.setNumberOfParts(2);
+        responseMsg.addObjPart(-1);
+        responseMsg.addObjPart(region.getFullPath());
+      }
+      else {
+
+        PartitionedRegion prRgion = (PartitionedRegion) region;
+
+        PartitionResolver partitionResolver = prRgion
+          .getPartitionResolver();
+        int numParts = 2; // MINUMUM PARTS
+        if (partitionResolver != null) {
+          numParts++;
+        }
+        if (prRgion.isFixedPartitionedRegion()) {
+          numParts++;
+        }
+        responseMsg.setNumberOfParts(numParts);
+        // PART 1
+        responseMsg.addObjPart(prRgion.getTotalNumberOfBuckets());
 
-            // PART 3
-            if (partitionResolver != null) {
-              responseMsg.addObjPart(partitionResolver.getClass().toString()
-                  .substring(6));
+        // PART 2
+        String leaderRegionPath = null;
+        PartitionedRegion leaderRegion = null;
+        String leaderRegionName = prRgion.getColocatedWith();
+        if (leaderRegionName != null) {
+          Cache cache = prRgion.getCache();
+          while (leaderRegionName != null) {
+            leaderRegion = (PartitionedRegion) cache
+              .getRegion(leaderRegionName);
+            if (leaderRegion.getColocatedWith() == null) {
+              leaderRegionPath = leaderRegion.getFullPath();
+              break;
             }
-            // PART 4
-            if (prRgion.isFixedPartitionedRegion()) {
-              Set<FixedPartitionAttributes> fpaSet = null;
-              if (leaderRegion != null) {
-                fpaSet = PartitionedRegionHelper
-                    .getAllFixedPartitionAttributes(leaderRegion);
-              } else {
-                fpaSet = PartitionedRegionHelper
-                    .getAllFixedPartitionAttributes(prRgion);
-              }
-              responseMsg.addObjPart(fpaSet);
+            else {
+              leaderRegionName = leaderRegion.getColocatedWith();
             }
           }
-          responseMsg.send();
-          msg.clearParts();
-        } catch (Exception e) {
-          writeException(msg, e, false, servConn);
-        } finally {
-          servConn.setAsTrue(Command.RESPONDED);
+        }
+        responseMsg.addObjPart(leaderRegionPath);
+
+        // PART 3
+        if (partitionResolver != null) {
+          responseMsg.addObjPart(partitionResolver.getClass().toString()
+            .substring(6));
+        }
+        // PART 4
+        if (prRgion.isFixedPartitionedRegion()) {
+          Set<FixedPartitionAttributes> fpaSet = null;
+          if (leaderRegion != null) {
+            fpaSet = PartitionedRegionHelper
+              .getAllFixedPartitionAttributes(leaderRegion);
+          }
+          else {
+            fpaSet = PartitionedRegionHelper
+              .getAllFixedPartitionAttributes(prRgion);
+          }
+          responseMsg.addObjPart(fpaSet);
         }
       }
+      responseMsg.send();
+      msg.clearParts();
+    }
+    catch (Exception e) {
+      writeException(msg, e, false, servConn);
+    }
+    finally {
+      servConn.setAsTrue(Command.RESPONDED);
     }
-  }
 
+  }
 }
+
+

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0f8694c3/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
new file mode 100644
index 0000000..fbbdc05
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.security;
+
+import java.util.Arrays;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.client.internal.GetClientPartitionAttributesOp;
+import com.gemstone.gemfire.cache.client.internal.PoolImpl;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(DistributedTest.class)
+public class IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  @Test
+  public void testGetClientPartitionAttrCmd() {
+    client1.invoke("logging in super-user with correct password", () -> {
+      ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567"))
+        .setPoolSubscriptionEnabled(true)
+        .addPoolServer("localhost", serverPort)
+        .create();
+
+      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+
+      assertNotAuthorized(() -> GetClientPartitionAttributesOp.execute((PoolImpl)cache.getDefaultPool(), REGION_NAME), "CLUSTER:READ");
+    });
+
+    client2.invoke("logging in super-user with correct password", () -> {
+      ClientCache cache = new ClientCacheFactory(createClientProperties("super-user", "1234567"))
+        .setPoolSubscriptionEnabled(true)
+        .addPoolServer("localhost", serverPort)
+        .create();
+
+      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+
+      GetClientPartitionAttributesOp.execute((PoolImpl)cache.getDefaultPool(), REGION_NAME);
+    });
+  }
+}
+
+


[03/26] incubator-geode git commit: Merge branch 'feature/GEODE-1571' of ssh://github.com/jinmeiliao/incubator-geode into feature/GEODE-1571

Posted by ji...@apache.org.
Merge branch 'feature/GEODE-1571' of ssh://github.com/jinmeiliao/incubator-geode into feature/GEODE-1571


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

Branch: refs/heads/feature/GEODE-1571
Commit: ceabe8c4835caa540b1f2d9c4cb1af0a36e53c08
Parents: 0f8694c b43d026
Author: gmeilen <gr...@gmail.com>
Authored: Mon Jun 27 14:23:40 2016 -0700
Committer: gmeilen <gr...@gmail.com>
Committed: Mon Jun 27 14:23:40 2016 -0700

----------------------------------------------------------------------
 .../internal/cache/AbstractCacheServer.java     |  19 +-
 .../gemfire/internal/cache/CacheServerImpl.java |   2 -
 .../internal/cache/RemoteOperationMessage.java  |   3 +-
 .../gemfire/internal/cache/TXManagerImpl.java   | 138 ++++++-
 .../gemfire/internal/cache/TXState.java         |  11 +
 .../gemfire/internal/cache/TXStateProxy.java    |   3 +
 .../internal/cache/TXStateProxyImpl.java        |   9 +
 .../cache/partitioned/PartitionMessage.java     |   3 +-
 .../cache/tier/sockets/AcceptorImpl.java        |   3 +-
 .../cache/tier/sockets/BaseCommand.java         |   1 +
 .../cache/tier/sockets/CacheClientNotifier.java |  23 +-
 .../cache/tier/sockets/ClientHealthMonitor.java |  11 +-
 .../tier/sockets/command/ExecuteFunction.java   |   2 +-
 .../tier/sockets/command/ExecuteFunction65.java |   2 +-
 .../tier/sockets/command/ExecuteFunction66.java |   2 +-
 .../sockets/command/ExecuteRegionFunction.java  |   2 +-
 .../command/ExecuteRegionFunction65.java        |   2 +-
 .../command/ExecuteRegionFunction66.java        |   2 +-
 .../command/ExecuteRegionFunctionSingleHop.java |   2 +-
 .../cache/tier/sockets/command/GetAll.java      |   2 +-
 .../cache/tier/sockets/command/GetAll651.java   |   2 +-
 .../cache/tier/sockets/command/GetAll70.java    |   2 +-
 .../sockets/command/GetFunctionAttribute.java   |   4 +-
 .../cache/xmlcache/CacheServerCreation.java     |   1 -
 .../internal/security/GeodeSecurityUtil.java    |   7 -
 .../management/internal/cli/CommandRequest.java |  22 +-
 .../management/internal/cli/GfshParser.java     |   8 +-
 .../gemfire/security/GeodePermission.java       |   6 +-
 .../disttx/DistributedTransactionDUnitTest.java |   3 +-
 .../cache/ClientServerTransactionDUnitTest.java | 276 +++++++++++--
 .../tier/sockets/AcceptorImplJUnitTest.java     |  10 +-
 .../internal/cli/CommandRequestTest.java        | 161 ++++++++
 .../cli/commands/CliCommandTestBase.java        |   2 +-
 .../commands/GemfireDataCommandsDUnitTest.java  |   1 -
 ...tegratedClientGetAllAuthDistributedTest.java |  20 +-
 ...ntegratedClientQueryAuthDistributedTest.java |  51 ---
 .../cache/query/internal/cq/ClientCQImpl.java   |   3 +-
 .../cache/tier/sockets/command/CloseCQ.java     |  25 +-
 .../cache/tier/sockets/command/GetCQStats.java  |  42 +-
 .../tier/sockets/command/GetDurableCQs.java     |  16 +-
 .../cache/tier/sockets/command/MonitorCQ.java   |  15 +-
 .../cache/tier/sockets/command/StopCQ.java      |  28 +-
 ...ntegratedClientQueryAuthDistributedTest.java | 100 +++++
 .../gemfire/cache/lucene/LuceneQuery.java       |  20 +-
 .../cache/lucene/LuceneQueryResults.java        |  57 ---
 .../gemfire/cache/lucene/LuceneService.java     |   2 +-
 .../lucene/PageableLuceneQueryResults.java      |  58 +++
 .../cache/lucene/internal/LuceneQueryImpl.java  |  63 ++-
 .../lucene/internal/LuceneQueryResultsImpl.java | 120 ------
 .../PageableLuceneQueryResultsImpl.java         | 121 ++++++
 .../lucene/internal/distributed/EntryScore.java |  10 +-
 .../lucene/internal/distributed/TopEntries.java |  16 +-
 ...IndexCreationPersistenceIntegrationTest.java |  11 +-
 .../LuceneIndexMaintenanceIntegrationTest.java  |  14 +-
 .../gemfire/cache/lucene/LuceneQueriesBase.java |   8 +-
 .../lucene/LuceneQueriesIntegrationTest.java    |  54 ++-
 ...LuceneQueriesPersistenceIntegrationTest.java |   2 +-
 .../LuceneQueryImplIntegrationTest.java         | 120 ------
 .../internal/LuceneQueryImplJUnitTest.java      | 150 +++++++
 .../LuceneQueryResultsImplJUnitTest.java        | 122 ------
 ...PageableLuceneQueryResultsImplJUnitTest.java | 142 +++++++
 .../DistributedScoringJUnitTest.java            |   8 +-
 .../distributed/EntryScoreJUnitTest.java        |   4 +-
 .../distributed/LuceneFunctionJUnitTest.java    |  11 +-
 .../TopEntriesCollectorJUnitTest.java           |  16 +-
 .../TopEntriesFunctionCollectorJUnitTest.java   |  13 +-
 .../distributed/TopEntriesJUnitTest.java        |  34 +-
 .../IndexRepositoryImplPerformanceTest.java     |   2 +-
 .../cache/lucene/test/LuceneTestUtilities.java  |  19 +-
 geode-site/website/README.md                    |   2 +-
 .../website/content/css/font-awesome.min.css    | 409 +------------------
 geode-site/website/content/css/geode-site.css   |  41 +-
 geode-site/website/content/font/FontAwesome.otf | Bin 61896 -> 124988 bytes
 .../content/font/fontawesome-webfont-eot.eot    | Bin 37405 -> 76518 bytes
 .../content/font/fontawesome-webfont-svg.svg    | 366 +++++++++++++++--
 .../content/font/fontawesome-webfont-ttf.ttf    | Bin 79076 -> 152796 bytes
 .../content/font/fontawesome-webfont-woff.woff  | Bin 43572 -> 90412 bytes
 geode-site/website/content/index.html           |  49 ++-
 geode-site/website/layouts/header.html          |  18 +-
 geode-site/website/lib/default.rb               |   4 +-
 geode-site/website/nanoc.yaml                   |   2 +
 .../DataCommandsOverHttpDistributedTest.java    | 150 +++++++
 82 files changed, 2031 insertions(+), 1254 deletions(-)
----------------------------------------------------------------------



[05/26] incubator-geode git commit: Merge branch 'feature/GEODE-1571' of ssh://github.com/jinmeiliao/incubator-geode into feature/GEODE-1571

Posted by ji...@apache.org.
Merge branch 'feature/GEODE-1571' of ssh://github.com/jinmeiliao/incubator-geode into feature/GEODE-1571


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

Branch: refs/heads/feature/GEODE-1571
Commit: cfbcba1162a10fb96c7acabfdcf82699772a6f3e
Parents: eb3ce44 ceabe8c
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Mon Jun 27 14:53:59 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Jun 27 14:53:59 2016 -0700

----------------------------------------------------------------------
 .../GetClientPartitionAttributesCommand.java    | 137 +++++++-------
 .../GetClientPartitionAttributesCommand66.java  | 180 ++++++++++---------
 ...ientPartitionAttrCmdAuthDistributedTest.java |  61 +++++++
 3 files changed, 228 insertions(+), 150 deletions(-)
----------------------------------------------------------------------



[19/26] incubator-geode git commit: Added SecurityTest to the Category. Reformatted to latest code style configuration.

Posted by ji...@apache.org.
Added SecurityTest to the Category.  Reformatted to latest code style configuration.


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

Branch: refs/heads/feature/GEODE-1571
Commit: 2557979bff3ccf6a2a034fae885e938c217bd3ed
Parents: 3879310
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Wed Jun 29 15:15:27 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Wed Jun 29 15:15:27 2016 -0700

----------------------------------------------------------------------
 .../security/IntegratedClientAuthDUnitTest.java |  25 +++--
 ...tedClientContainsKeyAuthDistributedTest.java |   3 +-
 ...entDestroyInvalidateAuthDistributedTest.java |  23 ++--
 ...dClientDestroyRegionAuthDistributedTest.java |  40 ++++---
 ...lientExecuteFunctionAuthDistributedTest.java |   3 +-
 ...xecuteRegionFunctionAuthDistributedTest.java |   6 +-
 ...tegratedClientGetAllAuthDistributedTest.java |   3 +-
 ...tGetClientPRMetaDataAuthDistributedTest.java |  28 ++---
 ...ientPartitionAttrCmdAuthDistributedTest.java |  12 ++-
 ...gratedClientGetEntryAuthDistributedTest.java |  37 +++----
 ...tegratedClientGetPutAuthDistributedTest.java |  58 +++++------
 ...tedClientRegionClearAuthDistributedTest.java |  23 ++--
 ...ientRegisterInterestAuthDistributedTest.java | 104 +++++++++----------
 ...ratedClientRemoveAllAuthDistributedTest.java |  25 +++--
 ...IntegratedClientSizeAuthDistributedTest.java |   3 +-
 ...ntUnregisterInterestAuthDistributedTest.java |  19 ++--
 16 files changed, 201 insertions(+), 211 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientAuthDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientAuthDUnitTest.java
index ccdc966..9eb12c4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientAuthDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientAuthDUnitTest.java
@@ -19,26 +19,26 @@ package com.gemstone.gemfire.security;
 import static com.googlecode.catchexception.CatchException.*;
 import static org.assertj.core.api.Assertions.*;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientAuthDUnitTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @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();
+      ClientCache cache = new ClientCacheFactory(createClientProperties("super-user", "1234567")).setPoolSubscriptionEnabled(true)
+                                                                                                 .addPoolServer("localhost", serverPort)
+                                                                                                 .create();
 
       ClientRegionFactory<String, String> crf = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
 
@@ -53,14 +53,13 @@ public class IntegratedClientAuthDUnitTest extends AbstractIntegratedClientAuthD
     client2.invoke("logging in super-user with wrong password", () -> {
       AuthenticationFailedException expected = new AuthenticationFailedException("Authentication error. Please check your username/password.");
 
-      catchException(new ClientCacheFactory(createClientProperties("super-user", "wrong"))
-          .setPoolSubscriptionEnabled(true)
-          .addPoolServer("localhost", serverPort))
-          .create();
+      catchException(new ClientCacheFactory(createClientProperties("super-user", "wrong")).setPoolSubscriptionEnabled(true)
+                                                                                          .addPoolServer("localhost", serverPort))
+        .create();
 
       //throw caughtException(); // TODO: gemfire-mm review as team
 
-      assertThat((Throwable)caughtException()).hasCause(expected);
+      assertThat((Throwable) caughtException()).hasCause(expected);
     });
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
index 558c427..f5bbcd4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
@@ -25,8 +25,9 @@ import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientContainsKeyAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
index 1b3ae21..febc608 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyInvalidateAuthDistributedTest.java
@@ -18,17 +18,18 @@ package com.gemstone.gemfire.security;
 
 import static org.junit.Assert.*;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientDestroyInvalidateAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
@@ -36,10 +37,9 @@ public class IntegratedClientDestroyInvalidateAuthDistributedTest extends Abstra
 
     // 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();
+      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"));
@@ -57,10 +57,9 @@ public class IntegratedClientDestroyInvalidateAuthDistributedTest extends Abstra
 
     // 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();
+      ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionReader", "1234567")).setPoolSubscriptionEnabled(true)
+                                                                                                       .addPoolServer("localhost", serverPort)
+                                                                                                       .create();
 
       Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyRegionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyRegionAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyRegionAuthDistributedTest.java
index 42d55f7..8f81c18 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyRegionAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientDestroyRegionAuthDistributedTest.java
@@ -18,45 +18,43 @@ package com.gemstone.gemfire.security;
 
 import static org.assertj.core.api.Assertions.*;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientDestroyRegionAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
   public void testDestroyRegion() throws InterruptedException {
-    client1.invoke(()-> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("dataWriter", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
+    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");
+      assertNotAuthorized(() -> region.destroyRegion(), "DATA:MANAGE");
     });
 
-    client2.invoke(()-> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionManager", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
+    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");
+      assertNotAuthorized(() -> region.destroyRegion(), "DATA:MANAGE");
     });
 
-    client3.invoke(()-> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("super-user", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
+    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();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
index 089517a..5af9f4c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteFunctionAuthDistributedTest.java
@@ -25,8 +25,9 @@ import com.gemstone.gemfire.cache.execute.FunctionService;
 import com.gemstone.gemfire.cache.execute.ResultCollector;
 import com.gemstone.gemfire.internal.cache.functions.TestFunction;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientExecuteFunctionAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   private final static Function function = new TestFunction(true, TestFunction.TEST_FUNCTION1);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
index ee5dff1..3665f63 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
@@ -25,9 +25,11 @@ import com.gemstone.gemfire.cache.execute.FunctionService;
 import com.gemstone.gemfire.cache.execute.ResultCollector;
 import com.gemstone.gemfire.internal.cache.functions.TestFunction;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(DistributedTest.class)
-public class IntegratedClientExecuteRegionFunctionAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+@Category({ DistributedTest.class, SecurityTest.class })
+public class IntegratedClientExecuteRegionFunctionAuthDistributedTest
+  extends AbstractIntegratedClientAuthDistributedTest {
 
   private final static Function function = new TestFunction(true, TestFunction.TEST_FUNCTION1);
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
index 792fa87..955f716 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
@@ -28,8 +28,9 @@ import org.junit.experimental.categories.Category;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientGetAllAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
index 899100e..dc2ecbd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
@@ -27,34 +27,34 @@ import com.gemstone.gemfire.cache.client.internal.ClientMetadataService;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(DistributedTest.class)
-public class IntegratedClientGetClientPRMetaDataAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+@Category({ DistributedTest.class, SecurityTest.class })
+public class IntegratedClientGetClientPRMetaDataAuthDistributedTest
+  extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
   public void testGetClientPartitionAttrCmd() {
     client1.invoke("logging in stranger", () -> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
+      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");
+      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();
+      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()));
+      ClientMetadataService service = ((GemFireCacheImpl) cache).getClientMetadataService();
+      service.getClientPRMetadata((LocalRegion) cache.getRegion(region.getName()));
     });
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
index 52c4a0c..05ce282 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
@@ -23,22 +23,24 @@ import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.internal.GetClientPartitionAttributesOp;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(DistributedTest.class)
-public class IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+@Category({ DistributedTest.class, SecurityTest.class })
+public class IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest
+  extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
   public void testGetClientPartitionAttrCmd() {
     client1.invoke("logging in stranger", () -> {
-      ClientCache cache =createClientCache("stranger", "1234567", serverPort);
+      ClientCache cache = createClientCache("stranger", "1234567", serverPort);
 
-      assertNotAuthorized(() -> GetClientPartitionAttributesOp.execute((PoolImpl)cache.getDefaultPool(), REGION_NAME), "CLUSTER:READ");
+      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);
+      GetClientPartitionAttributesOp.execute((PoolImpl) cache.getDefaultPool(), REGION_NAME);
     });
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
index b4eff71..8472af9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetEntryAuthDistributedTest.java
@@ -17,6 +17,9 @@
 package com.gemstone.gemfire.security;
 
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.CacheTransactionManager;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
@@ -24,48 +27,42 @@ import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
-public class IntegratedClientGetEntryAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest{
+@Category({ DistributedTest.class, SecurityTest.class })
+public class IntegratedClientGetEntryAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @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();
+    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 {
+        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();
+    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 {
+      } finally {
         transactionManager.commit();
       }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
index 37f9e80..e04ad3f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
@@ -24,17 +24,18 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
@@ -48,34 +49,32 @@ public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegrate
     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();
+    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.put("key3", "value3"), "DATA:WRITE:AuthRegion:key3");
-      assertNotAuthorized(()->region.get("key3"), "DATA:READ:AuthRegion:key3");
+      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");
+      assertNotAuthorized(() -> region.putAll(allValues), "DATA:WRITE:AuthRegion");
 
       // not authorized for either keys, get no record back
-      Map keyValues =  region.getAll(keys);
+      Map keyValues = region.getAll(keys);
       assertEquals(0, keyValues.size());
 
-      assertNotAuthorized(()->region.keySetOnServer(), "DATA:READ:AuthRegion");
+      assertNotAuthorized(() -> region.keySetOnServer(), "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();
+    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);
 
@@ -86,7 +85,7 @@ public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegrate
       region.putAll(allValues);
 
       // get all
-      Map keyValues =  region.getAll(keys);
+      Map keyValues = region.getAll(keys);
       assertEquals(2, keyValues.size());
 
       // keyset
@@ -95,25 +94,24 @@ public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegrate
     });
 
     // 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();
+    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.put("key2", "value1"), "DATA:WRITE:AuthRegion:key2");
-      assertNotAuthorized(()->region.get("key2"), "DATA:READ:AuthRegion:key2");
+      assertNotAuthorized(() -> region.put("key2", "value1"), "DATA:WRITE:AuthRegion:key2");
+      assertNotAuthorized(() -> region.get("key2"), "DATA:READ:AuthRegion:key2");
 
-      assertNotAuthorized(()->region.putAll(allValues), "DATA:WRITE:AuthRegion");
+      assertNotAuthorized(() -> region.putAll(allValues), "DATA:WRITE:AuthRegion");
 
       // only authorized for one recrod
-      Map keyValues =  region.getAll(keys);
+      Map keyValues = region.getAll(keys);
       assertEquals(1, keyValues.size());
 
       // keyset
-      assertNotAuthorized(()->region.keySetOnServer(), "DATA:READ:AuthRegion");
+      assertNotAuthorized(() -> region.keySetOnServer(), "DATA:READ:AuthRegion");
     });
 
     ai1.join();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegionClearAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegionClearAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegionClearAuthDistributedTest.java
index 44985c7..1e63f53 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegionClearAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegionClearAuthDistributedTest.java
@@ -16,17 +16,18 @@
  */
 package com.gemstone.gemfire.security;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientRegionClearAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
@@ -35,10 +36,9 @@ public class IntegratedClientRegionClearAuthDistributedTest extends AbstractInte
     SerializableRunnable clearUnauthorized = new SerializableRunnable() {
       @Override
       public void run() {
-        ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567"))
-          .setPoolSubscriptionEnabled(true)
-          .addPoolServer("localhost", serverPort)
-          .create();
+        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");
@@ -50,10 +50,9 @@ public class IntegratedClientRegionClearAuthDistributedTest extends AbstractInte
     SerializableRunnable clearAuthorized = new SerializableRunnable() {
       @Override
       public void run() {
-        ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionUser", "1234567"))
-          .setPoolSubscriptionEnabled(true)
-          .addPoolServer("localhost", serverPort)
-          .create();
+        ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionUser", "1234567")).setPoolSubscriptionEnabled(true)
+                                                                                                       .addPoolServer("localhost", serverPort)
+                                                                                                       .create();
 
         Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
         region.clear();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegisterInterestAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegisterInterestAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegisterInterestAuthDistributedTest.java
index 373b7dd..0036a38 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegisterInterestAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRegisterInterestAuthDistributedTest.java
@@ -19,52 +19,50 @@ package com.gemstone.gemfire.security;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientRegisterInterestAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @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();
+    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");
+      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();
+    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();
+    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");
+      assertNotAuthorized(() -> region.registerInterest("key2"), "DATA:READ:AuthRegion:key2");
     });
 
     ai1.join();
@@ -79,37 +77,34 @@ public class IntegratedClientRegisterInterestAuthDistributedTest extends Abstrac
   @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();
+    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");
+      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();
+    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();
+    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");
+      assertNotAuthorized(() -> region.registerInterestRegex("key[0-9]+"), "DATA:READ:AuthRegion");
+      assertNotAuthorized(() -> region.registerInterestRegex("key1"), "DATA:READ:AuthRegion");
     });
 
     ai1.join();
@@ -128,36 +123,33 @@ public class IntegratedClientRegisterInterestAuthDistributedTest extends Abstrac
     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();
+    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");
+      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();
+    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();
+    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");
+      assertNotAuthorized(() -> region.registerInterest(keys), "DATA:READ:AuthRegion");
     });
 
     ai1.join();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java
index 46ed1b8..8eb4ebf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientRemoveAllAuthDistributedTest.java
@@ -20,42 +20,41 @@ import static org.junit.Assert.*;
 
 import java.util.Arrays;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientRemoveAllAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
   public void testRemoveAll() throws InterruptedException {
 
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionReader", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
+      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();
+      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");
+      assertNotAuthorized(() -> region.containsKeyOnServer("key1"), "DATA:READ:AuthRegion:key1");
     });
     ai1.join();
     ai2.join();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
index d0624a9..b1c1258 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
@@ -26,8 +26,9 @@ import com.gemstone.gemfire.cache.client.internal.InternalPool;
 import com.gemstone.gemfire.cache.client.internal.SizeOp;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class IntegratedClientSizeAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2557979b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
index 082474a..e6152ee 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientUnregisterInterestAuthDistributedTest.java
@@ -16,26 +16,27 @@
  */
 package com.gemstone.gemfire.security;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+@Category({ DistributedTest.class, SecurityTest.class })
+public class IntegratedClientUnregisterInterestAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
-@Category(DistributedTest.class)
-public class IntegratedClientUnregisterInterestAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest{
   @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();
+    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");


[20/26] incubator-geode git commit: GEODE-11: Added JMX MBean API providing raw stat values

Posted by ji...@apache.org.
GEODE-11: Added JMX MBean API providing raw stat values


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

Branch: refs/heads/feature/GEODE-1571
Commit: ee057745cfb13a9f1bbea6ca41580afba28633e6
Parents: 63ce3c0
Author: Barry Oglesby <bo...@pivotal.io>
Authored: Tue Jun 28 16:01:03 2016 -0700
Committer: Barry Oglesby <bo...@pivotal.io>
Committed: Thu Jun 30 09:59:10 2016 -0700

----------------------------------------------------------------------
 .../distributed/internal/ResourceEvent.java     |   4 +-
 .../gemfire/internal/cache/CacheService.java    |   7 +
 .../internal/cache/GemFireCacheImpl.java        |   1 +
 .../gemfire/management/JMXNotificationType.java |   7 +
 .../management/internal/MBeanJMXAdapter.java    |   5 +
 .../internal/ManagementConstants.java           |   8 +-
 .../internal/beans/CacheServiceMBeanBase.java   |  24 +++
 .../internal/beans/ManagementAdapter.java       |  30 +++-
 .../internal/beans/ManagementListener.java      |   7 +-
 .../internal/cache/MockCacheServiceImpl.java    |   6 +
 .../cache/lucene/internal/IndexListener.java    |  35 ++++
 .../cache/lucene/internal/LuceneIndexStats.java |  39 +++++
 .../lucene/internal/LuceneServiceImpl.java      |   9 +-
 .../internal/management/LuceneIndexMetrics.java | 161 +++++++++++++++++++
 .../management/LuceneServiceBridge.java         |  82 ++++++++++
 .../internal/management/LuceneServiceMBean.java |  57 +++++++
 .../management/LuceneServiceMXBean.java         |  58 +++++++
 17 files changed, 534 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ResourceEvent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ResourceEvent.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ResourceEvent.java
index 2250bf4..584975e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ResourceEvent.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/ResourceEvent.java
@@ -45,7 +45,9 @@ public enum ResourceEvent {
     GATEWAYSENDER_START, 
     GATEWAYSENDER_STOP, 
     GATEWAYSENDER_PAUSE, 
-    GATEWAYSENDER_RESUME 
+    GATEWAYSENDER_RESUME,
+    CACHE_SERVICE_CREATE,
+    CACHE_SERVICE_REMOVE
     
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheService.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheService.java
index a8c4cb8..b1d3b62 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheService.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CacheService.java
@@ -17,6 +17,7 @@
 package com.gemstone.gemfire.internal.cache;
 
 import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
 
 /**
  * Interface for a service that is linked to a cache.
@@ -39,4 +40,10 @@ public interface CacheService {
    * this service. 
    */
   public Class<? extends CacheService> getInterface();
+
+  /**
+   * Returns the MBean associated with this server
+   * @return the MBean associated with this server
+   */
+  public CacheServiceMBeanBase getMBean();
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
index 186ebbc..13e0602 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java
@@ -1101,6 +1101,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
     for(CacheService service : loader) {
       service.init(this);
       this.services.put(service.getInterface(), service);
+      system.handleResourceEvent(ResourceEvent.CACHE_SERVICE_CREATE, service);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/management/JMXNotificationType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/JMXNotificationType.java b/geode-core/src/main/java/com/gemstone/gemfire/management/JMXNotificationType.java
index 4726583..199f9ae 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/JMXNotificationType.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/JMXNotificationType.java
@@ -206,4 +206,11 @@ public interface JMXNotificationType {
    * <CODE>gemfire.distributedsystem.locator.started</CODE>.
    */
   public static final String LOCATOR_STARTED = DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.locator.started";
+
+  /**
+   * Notification type which indicates that a cache service is created <BR>
+   * The value of this type string is
+   * <CODE>gemfire.distributedsystem.cache.service.created</CODE>.
+   */
+  public static final String CACHE_SERVICE_CREATED = DistributionConfig.GEMFIRE_PREFIX + "distributedsystem.cache.service.created";
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/management/internal/MBeanJMXAdapter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/MBeanJMXAdapter.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/MBeanJMXAdapter.java
index 345c452..bf116d0 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/MBeanJMXAdapter.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/MBeanJMXAdapter.java
@@ -574,6 +574,11 @@ public class MBeanJMXAdapter implements ManagementConstants {
     return getObjectName((MessageFormat.format(OBJECTNAME__LOCATOR_MXBEAN, new Object[] { makeCompliantName(member) })));
   }
 
+  public static ObjectName getCacheServiceMBeanName(DistributedMember member, String cacheServiceId) {
+    return getObjectName((MessageFormat.format(OBJECTNAME__CACHESERVICE_MXBEAN, new Object[] { cacheServiceId,
+        getMemberNameOrId(member) })));
+  }
+
   public Map<ObjectName, Object> getLocalGemFireMBean() {
     return this.localGemFireMBean;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementConstants.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementConstants.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementConstants.java
index 8598104..ca04573 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementConstants.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementConstants.java
@@ -119,7 +119,9 @@ public interface ManagementConstants {
   public static final String OBJECTNAME__DISKSTORE_MXBEAN              = OBJECTNAME__PREFIX + "service=DiskStore,name={0},type=Member,member={1}";
   
   public static final String OBJECTNAME__LOCATOR_MXBEAN                = OBJECTNAME__PREFIX + "service=Locator,type=Member,member={0}";
-  
+
+  public static final String OBJECTNAME__CACHESERVICE_MXBEAN           = OBJECTNAME__PREFIX + "service=CacheService,name={0},type=Member,member={1}";
+
   public static final String AGGREGATE_MBEAN_PATTERN                   = OBJECTNAME__PREFIX + "*,type=Distributed";
   // Object Name keys 
   
@@ -171,7 +173,9 @@ public interface ManagementConstants {
   public static final String GATEWAY_RECEIVER_STOPPED_PREFIX= "GatewayReceiver Stopped in the VM ";
   
   public static final String ASYNC_EVENT_QUEUE_CREATED_PREFIX= "Async Event Queue is Created  in the VM ";
-  
+
+  public static final String CACHE_SERVICE_CREATED_PREFIX= "Cache Service Created With Name ";
+
   public static final String CACHE_SERVER_STARTED_PREFIX= "Cache Server is Started in the VM ";
   public static final String CACHE_SERVER_STOPPED_PREFIX= "Cache Server is stopped in the VM ";
   

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

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementAdapter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementAdapter.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementAdapter.java
index b1cc9fc..a288338 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementAdapter.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementAdapter.java
@@ -32,6 +32,8 @@ import javax.management.NotificationBroadcasterSupport;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
 
+import com.gemstone.gemfire.distributed.internal.DistributionManager;
+import com.gemstone.gemfire.internal.cache.CacheService;
 import org.apache.logging.log4j.Logger;
 
 import com.gemstone.gemfire.cache.Cache;
@@ -1062,7 +1064,33 @@ public class ManagementAdapter {
 
   }
 
-  
+  public void handleCacheServiceCreation(CacheService cacheService)
+      throws ManagementException {
+    if (!isServiceInitialised("handleCacheServiceCreation")) {
+      return;
+    }
+    // Don't register the CacheServices in the Locator
+    InternalDistributedMember member = cacheImpl.getDistributedSystem().getDistributedMember();
+    if (member.getVmKind() == DistributionManager.LOCATOR_DM_TYPE) {
+      return;
+    }
+    CacheServiceMBeanBase mbean = cacheService.getMBean();
+    if (mbean != null) {
+      String id = mbean.getId();
+      ObjectName cacheServiceObjectName = MBeanJMXAdapter.getCacheServiceMBeanName(member, id);
+
+      ObjectName changedMBeanName = service.registerInternalMBean(mbean, cacheServiceObjectName);
+
+      service.federate(changedMBeanName, mbean.getInterfaceClass(), true);
+
+      Notification notification = new Notification(
+          JMXNotificationType.CACHE_SERVICE_CREATED, memberSource,
+          SequenceNumber.next(), System.currentTimeMillis(),
+          ManagementConstants.CACHE_SERVICE_CREATED_PREFIX + id);
+      memberLevelNotifEmitter.sendNotification(notification);
+    }
+  }
+
   /**
    * Private class which acts as a ClientMembershipListener to propagate client
    * joined/left notifications

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementListener.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementListener.java
index 5947727..24dc94d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementListener.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/beans/ManagementListener.java
@@ -29,6 +29,7 @@ import com.gemstone.gemfire.distributed.internal.ResourceEvent;
 import com.gemstone.gemfire.distributed.internal.ResourceEventsListener;
 import com.gemstone.gemfire.distributed.internal.locks.DLockService;
 import com.gemstone.gemfire.i18n.LogWriterI18n;
+import com.gemstone.gemfire.internal.cache.CacheService;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.management.ManagementException;
 import com.gemstone.gemfire.management.internal.AlertDetails;
@@ -205,7 +206,11 @@ public class ManagementListener implements ResourceEventsListener{
       case LOCATOR_START:
         Locator loc = (Locator) resource;
         adapter.handleLocatorStart(loc);
-        break; 
+        break;
+      case CACHE_SERVICE_CREATE:
+        CacheService service = (CacheService) resource;
+        adapter.handleCacheServiceCreation(service);
+        break;
       default:
       break;
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MockCacheServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MockCacheServiceImpl.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MockCacheServiceImpl.java
index 4653ddf..1ba82f1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MockCacheServiceImpl.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MockCacheServiceImpl.java
@@ -17,6 +17,7 @@
 package com.gemstone.gemfire.internal.cache;
 
 import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
 
 public class MockCacheServiceImpl implements MockCacheService {
   
@@ -33,6 +34,11 @@ public class MockCacheServiceImpl implements MockCacheService {
   }
 
   @Override
+  public CacheServiceMBeanBase getMBean() {
+    return null;
+  }
+
+  @Override
   public Cache getCache() {
     return cache;
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java
new file mode 100644
index 0000000..c9c03a5
--- /dev/null
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/IndexListener.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.internal;
+
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import org.apache.lucene.analysis.Analyzer;
+
+import java.util.Map;
+
+public interface IndexListener {
+
+  public void beforeIndexCreated(final String indexName, String regionPath,
+      final Analyzer analyzer, final Map<String, Analyzer> fieldAnalyzers,
+      final String... fields);
+
+  public void afterIndexCreated(LuceneIndex index);
+
+  public void beforeIndexDestroyed(LuceneIndex index);
+
+  public void afterIndexDestroyed(LuceneIndex index);
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
index 8e2d97c..703f9da 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
@@ -156,4 +156,43 @@ public class LuceneIndexStats {
       .sum();
   }
 
+  public int getQueryExecutions() {
+    return stats.getInt(queryExecutionsId);
+  }
+
+  public long getQueryExecutionTime() {
+    return stats.getLong(queryExecutionTimeId);
+  }
+
+  public int getQueryExecutionsInProgress() {
+    return stats.getInt(queryExecutionsInProgressId);
+  }
+
+  public long getQueryExecutionTotalHits() {
+    return stats.getLong(queryExecutionTotalHits);
+  }
+
+  public int getUpdates() {
+    return stats.getInt(updatesId);
+  }
+
+  public long getUpdateTime() {
+    return stats.getLong(updateTimeId);
+  }
+
+  public int getUpdatesInProgress() {
+    return stats.getInt(updatesInProgressId);
+  }
+
+  public int getCommits() {
+    return stats.getInt(commitsId);
+  }
+
+  public long getCommitTime() {
+    return stats.getLong(commitTimeId);
+  }
+
+  public int getCommitsInProgress() {
+    return stats.getInt(commitsInProgressId);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
index 6bfaa78..410b27b 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
@@ -21,6 +21,8 @@ package com.gemstone.gemfire.cache.lucene.internal;
 
 import java.util.*;
 
+import com.gemstone.gemfire.cache.lucene.internal.management.LuceneServiceMBean;
+import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
 import org.apache.logging.log4j.Logger;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper;
@@ -86,7 +88,12 @@ public class LuceneServiceImpl implements InternalLuceneService {
     FunctionService.registerFunction(new DumpDirectoryFiles());
     registerDataSerializables();
   }
-  
+
+  @Override
+  public CacheServiceMBeanBase getMBean() {
+    return new LuceneServiceMBean(this);
+  }
+
   @Override
   public Class<? extends CacheService> getInterface() {
     return InternalLuceneService.class;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java
new file mode 100644
index 0000000..10c08a7
--- /dev/null
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneIndexMetrics.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.internal.management;
+
+import java.beans.ConstructorProperties;
+
+public class LuceneIndexMetrics {
+
+  private final String regionPath;
+
+  private final String indexName;
+
+  private final int queryExecutions;
+
+  private final long queryExecutionTime;
+
+  private final int queryExecutionsInProgress;
+
+  private final long queryExecutionTotalHits;
+
+  private final int updates;
+
+  private final long updateTime;
+
+  private final int updatesInProgress;
+
+  private final int commits;
+
+  private final long commitTime;
+
+  private final int commitsInProgress;
+
+  private final int documents;
+
+  /**
+   * This constructor is to be used by internal JMX framework only. A user should
+   * not try to create an instance of this class.
+   */
+  @ConstructorProperties( { "regionPath", "indexName", "queryExecutions", "queryExecutionTime",
+      "queryExecutionsInProgress", "queryExecutionTotalHits", "updates", "updateTime", "updatesInProgress",
+      "commits", "commitTime", "commitsInProgress", "documents"
+  })
+  public LuceneIndexMetrics(String regionPath, String indexName, int queryExecutions, long queryExecutionTime,
+      int queryExecutionsInProgress, long queryExecutionTotalHits, int updates, long updateTime,
+      int updatesInProgress, int commits, long commitTime, int commitsInProgress, int documents) {
+    this.regionPath = regionPath;
+    this.indexName = indexName;
+    this.queryExecutions = queryExecutions;
+    this.queryExecutionTime = queryExecutionTime;
+    this.queryExecutionsInProgress = queryExecutionsInProgress;
+    this.queryExecutionTotalHits = queryExecutionTotalHits;
+    this.updates = updates;
+    this.updateTime = updateTime;
+    this.updatesInProgress = updatesInProgress;
+    this.commits = commits;
+    this.commitTime = commitTime;
+    this.commitsInProgress = commitsInProgress;
+    this.documents = documents;
+  }
+
+  public String getRegionPath() {
+    return this.regionPath;
+  }
+
+  public String getIndexName() {
+    return this.indexName;
+  }
+
+  public int getQueryExecutions() {
+    return this.queryExecutions;
+  }
+
+  public long getQueryExecutionTime() {
+    return this.queryExecutionTime;
+  }
+
+  public int getQueryExecutionsInProgress() {
+    return this.queryExecutionsInProgress;
+  }
+
+  public long getQueryExecutionTotalHits() {
+    return this.queryExecutionTotalHits;
+  }
+
+  public int getUpdates() {
+    return this.updates;
+  }
+
+  public long getUpdateTime() {
+    return this.updateTime;
+  }
+
+  public int getUpdatesInProgress() {
+    return this.updatesInProgress;
+  }
+
+  public int getCommits() {
+    return this.commits;
+  }
+
+  public long getCommitTime() {
+    return this.commitTime;
+  }
+
+  public int getCommitsInProgress() {
+    return this.commitsInProgress;
+  }
+
+  public int getDocuments() {
+    return documents;
+  }
+
+  @Override
+  public String toString() {
+    return new StringBuilder()
+        .append(getClass().getSimpleName())
+        .append("[")
+        .append("regionPath=")
+        .append(this.regionPath)
+        .append("; indexName=")
+        .append(this.indexName)
+        .append("; queryExecutions=")
+        .append(this.queryExecutions)
+        .append("; queryExecutionTime=")
+        .append(this.queryExecutionTime)
+        .append("; queryExecutionsInProgress=")
+        .append(this.queryExecutionsInProgress)
+        .append("; queryExecutionTotalHits=")
+        .append(this.queryExecutionTotalHits)
+        .append("; updates=")
+        .append(this.updates)
+        .append("; updateTime=")
+        .append(this.updateTime)
+        .append("; updatesInProgress=")
+        .append(this.updatesInProgress)
+        .append("; commits=")
+        .append(this.commits)
+        .append("; commitTime=")
+        .append(this.commitTime)
+        .append("; commitsInProgress=")
+        .append(this.commitsInProgress)
+        .append("; documents=")
+        .append(this.documents)
+        .append("]")
+        .toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java
new file mode 100644
index 0000000..b851b2c
--- /dev/null
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceBridge.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.internal.management;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.lucene.LuceneIndex;
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexImpl;
+import com.gemstone.gemfire.cache.lucene.internal.LuceneIndexStats;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class LuceneServiceBridge {
+
+  private LuceneService service;
+
+  public LuceneServiceBridge(LuceneService service) {
+    this.service = service;
+  }
+
+  public LuceneIndexMetrics[] listIndexMetrics() {
+    Collection<LuceneIndex> indexes = this.service.getAllIndexes();
+    LuceneIndexMetrics[] indexMetrics = new LuceneIndexMetrics[indexes.size()];
+    int i=0;
+    for (LuceneIndex index : this.service.getAllIndexes()) {
+      indexMetrics[i++] = getIndexMetrics((LuceneIndexImpl)index);
+    }
+    return indexMetrics;
+  }
+
+  public LuceneIndexMetrics[] listIndexMetrics(String regionPath) {
+    if(!regionPath.startsWith(Region.SEPARATOR)) {
+      regionPath = Region.SEPARATOR + regionPath;
+    }
+    List<LuceneIndexMetrics> indexMetrics = new ArrayList();
+    for (LuceneIndex index : this.service.getAllIndexes()) {
+      if (index.getRegionPath().equals(regionPath)) {
+        indexMetrics.add(getIndexMetrics((LuceneIndexImpl) index));
+      }
+    }
+    return indexMetrics.toArray(new LuceneIndexMetrics[indexMetrics.size()]);
+  }
+
+  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName) {
+    LuceneIndexImpl index = (LuceneIndexImpl) this.service.getIndex(indexName, regionPath);
+    return index == null ? null : getIndexMetrics(index);
+  }
+
+  private LuceneIndexMetrics getIndexMetrics(LuceneIndexImpl index) {
+    LuceneIndexStats indexStats = index.getIndexStats();
+    int queryExecutions = indexStats.getQueryExecutions();
+    long queryExecutionTime = indexStats.getQueryExecutionTime();
+    int queryExecutionsInProgress = indexStats.getQueryExecutionsInProgress();
+    long queryExecutionTotalHits = indexStats.getQueryExecutionTotalHits();
+    int updates = indexStats.getUpdates();
+    long updateTime = indexStats.getUpdateTime();
+    int updatesInProgress = indexStats.getUpdatesInProgress();
+    int commits = indexStats.getCommits();
+    long commitTime = indexStats.getCommitTime();
+    int commitsInProgress = indexStats.getCommitsInProgress();
+    int documents = indexStats.getDocuments();
+    return new LuceneIndexMetrics(index.getRegionPath(), index.getName(), queryExecutions, queryExecutionTime,
+        queryExecutionsInProgress, queryExecutionTotalHits, updates, updateTime, updatesInProgress, commits,
+        commitTime, commitsInProgress, documents);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java
new file mode 100644
index 0000000..6eb0b69
--- /dev/null
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMBean.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.internal.management;
+
+import com.gemstone.gemfire.cache.lucene.LuceneService;
+import com.gemstone.gemfire.management.internal.beans.CacheServiceMBeanBase;
+
+import javax.management.NotificationBroadcasterSupport;
+
+public class LuceneServiceMBean extends NotificationBroadcasterSupport
+    implements LuceneServiceMXBean, CacheServiceMBeanBase {
+
+  private LuceneServiceBridge bridge;
+
+  public LuceneServiceMBean(LuceneService service) {
+    this.bridge = new LuceneServiceBridge(service);
+  }
+
+  @Override
+  public LuceneIndexMetrics[] listIndexMetrics() {
+    return this.bridge.listIndexMetrics();
+  }
+
+  @Override
+  public LuceneIndexMetrics[] listIndexMetrics(String regionPath) {
+    return this.bridge.listIndexMetrics(regionPath);
+  }
+
+  @Override
+  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName) {
+    return this.bridge.listIndexMetrics(regionPath, indexName);
+  }
+
+  @Override
+  public String getId() {
+    return "LuceneService";
+  }
+
+  @Override
+  public Class getInterfaceClass() {
+    return LuceneServiceMXBean.class;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ee057745/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java
new file mode 100644
index 0000000..7911a25
--- /dev/null
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/management/LuceneServiceMXBean.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.lucene.internal.management;
+
+import com.gemstone.gemfire.cache.operations.OperationContext;
+import com.gemstone.gemfire.management.internal.security.ResourceOperation;
+
+/**
+ * MBean that provides access to the {@link com.gemstone.gemfire.cache.lucene.LuceneService}.
+ */
+@ResourceOperation(resource = OperationContext.Resource.CLUSTER, operation = OperationContext.OperationCode.READ)
+public interface LuceneServiceMXBean {
+
+  /**
+   * Returns an array of {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
+   * instances defined in this member
+   *
+   * @return an array of LuceneIndexMetrics for the LuceneIndexes defined in this member
+   */
+  public LuceneIndexMetrics[] listIndexMetrics();
+
+  /**
+   * Returns an array of {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
+   * instances defined on the input region in this member
+   *
+   * @param regionPath The full path of the region to retrieve
+   *
+   * @return an array of LuceneIndexMetrics for the LuceneIndex instances defined on the input region
+   * in this member
+   */
+  public LuceneIndexMetrics[] listIndexMetrics(String regionPath);
+
+  /**
+   * Returns a {@link LuceneIndexMetrics} for the {@link com.gemstone.gemfire.cache.lucene.LuceneIndex}
+   * with the input index name defined on the input region in this member.
+   *
+   * @param regionPath The full path of the region to retrieve
+   * @param indexName The name of the index to retrieve
+   *
+   * @return a LuceneIndexMetrics for the LuceneIndex with the input index name defined on the input region
+   * in this member.
+   */
+  public LuceneIndexMetrics listIndexMetrics(String regionPath, String indexName);
+}


[26/26] incubator-geode git commit: GEODE-1571: do not have the post processor blead into other tests

Posted by ji...@apache.org.
GEODE-1571: do not have the post processor blead into other tests


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

Branch: refs/heads/feature/GEODE-1571
Commit: b37f43932423342d976e1b4f3c0a20c1198197b8
Parents: cd0d11a
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Jun 30 12:22:22 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Jun 30 12:22:22 2016 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/internal/security/GeodeSecurityUtil.java    | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b37f4393/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index a80e522..3a4edef 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -332,6 +332,10 @@ public class GeodeSecurityUtil {
       postProcessor = (PostProcessor) postProcessObject;
       postProcessor.init(securityProps);
     }
+    else{
+      postProcessor = null;
+    }
+
   }
 
   public static Object postProcess(String regionPath, Object key, Object result){


[07/26] incubator-geode git commit: Added ClientPRMetaData test

Posted by ji...@apache.org.
Added ClientPRMetaData test


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

Branch: refs/heads/feature/GEODE-1571
Commit: 3483b11217dc408533fbac1fa963c9fac45739f7
Parents: ceabe8c
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Mon Jun 27 15:23:23 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Mon Jun 27 15:23:23 2016 -0700

----------------------------------------------------------------------
 ...tGetClientPRMetaDataAuthDistributedTest.java | 62 ++++++++++++++++++++
 ...ientPartitionAttrCmdAuthDistributedTest.java |  8 +--
 2 files changed, 65 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3483b112/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
new file mode 100644
index 0000000..899100e
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPRMetaDataAuthDistributedTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.security;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.client.internal.ClientMetadataService;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class IntegratedClientGetClientPRMetaDataAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  @Test
+  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/incubator-geode/blob/3483b112/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
index fbbdc05..edfa72a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
@@ -16,7 +16,8 @@
  */
 package com.gemstone.gemfire.security;
 
-import java.util.Arrays;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
@@ -26,15 +27,12 @@ import com.gemstone.gemfire.cache.client.internal.GetClientPartitionAttributesOp
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 @Category(DistributedTest.class)
 public class IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
   public void testGetClientPartitionAttrCmd() {
-    client1.invoke("logging in super-user with correct password", () -> {
+    client1.invoke("logging in stranger", () -> {
       ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567"))
         .setPoolSubscriptionEnabled(true)
         .addPoolServer("localhost", serverPort)


[23/26] incubator-geode git commit: Merge branch 'feature/GEODE-1571' of ssh://github.com/jinmeiliao/incubator-geode into feature/GEODE-1571

Posted by ji...@apache.org.
Merge branch 'feature/GEODE-1571' of ssh://github.com/jinmeiliao/incubator-geode into feature/GEODE-1571

# Conflicts:
#	geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java


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

Branch: refs/heads/feature/GEODE-1571
Commit: aa2007baae9f0ecd5367c8d917bb3a511a39c58a
Parents: 39c5684 2557979
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Jun 30 12:00:25 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Jun 30 12:00:25 2016 -0700

----------------------------------------------------------------------
 .../cache/tier/sockets/command/Size.java        | 141 ++++++++-----------
 .../security/IntegratedClientAuthDUnitTest.java |  25 ++--
 ...tedClientContainsKeyAuthDistributedTest.java |   3 +-
 ...entDestroyInvalidateAuthDistributedTest.java |  23 ++-
 ...dClientDestroyRegionAuthDistributedTest.java |  40 +++---
 ...lientExecuteFunctionAuthDistributedTest.java |  61 ++++++++
 ...xecuteRegionFunctionAuthDistributedTest.java |  62 ++++++++
 ...tegratedClientGetAllAuthDistributedTest.java |   3 +-
 ...tGetClientPRMetaDataAuthDistributedTest.java |  28 ++--
 ...ientPartitionAttrCmdAuthDistributedTest.java |  12 +-
 ...gratedClientGetEntryAuthDistributedTest.java |  37 +++--
 ...tegratedClientGetPutAuthDistributedTest.java |  25 ++--
 ...tedClientRegionClearAuthDistributedTest.java |  23 ++-
 ...ientRegisterInterestAuthDistributedTest.java | 104 +++++++-------
 ...ratedClientRemoveAllAuthDistributedTest.java |  25 ++--
 ...IntegratedClientSizeAuthDistributedTest.java |  58 ++++++++
 ...ntUnregisterInterestAuthDistributedTest.java |  19 +--
 17 files changed, 417 insertions(+), 272 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/aa2007ba/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
index 0630ecf,e04ad3f..630e340
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetPutAuthDistributedTest.java
@@@ -29,10 -29,13 +29,11 @@@ import org.junit.experimental.categorie
  
  import com.gemstone.gemfire.cache.Region;
  import com.gemstone.gemfire.cache.client.ClientCache;
 -import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 -import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
  import com.gemstone.gemfire.test.dunit.AsyncInvocation;
  import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+ import com.gemstone.gemfire.test.junit.categories.SecurityTest;
  
- @Category(DistributedTest.class)
+ @Category({ DistributedTest.class, SecurityTest.class })
  public class IntegratedClientGetPutAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
  
    @Test
@@@ -46,21 -49,24 +47,21 @@@
      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);
 +    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");
+       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");
+       assertNotAuthorized(() -> region.putAll(allValues), "DATA:WRITE:AuthRegion");
  
        // not authorized for either keys, get no record back
-       Map keyValues =  region.getAll(keys);
+       Map keyValues = region.getAll(keys);
        assertEquals(0, keyValues.size());
  
-       assertNotAuthorized(()->region.keySetOnServer(), "DATA:READ:AuthRegion");
+       assertNotAuthorized(() -> region.keySetOnServer(), "DATA:READ:AuthRegion");
      });
  
  
@@@ -85,17 -94,20 +86,17 @@@
      });
  
      // 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);
 +    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.put("key2", "value1"), "DATA:WRITE:AuthRegion:key2");
+       assertNotAuthorized(() -> region.get("key2"), "DATA:READ:AuthRegion:key2");
  
-       assertNotAuthorized(()->region.putAll(allValues), "DATA:WRITE:AuthRegion");
+       assertNotAuthorized(() -> region.putAll(allValues), "DATA:WRITE:AuthRegion");
  
        // only authorized for one recrod
-       Map keyValues =  region.getAll(keys);
+       Map keyValues = region.getAll(keys);
        assertEquals(1, keyValues.size());
  
        // keyset


[12/26] incubator-geode git commit: Added ExecuteRegionFunction test

Posted by ji...@apache.org.
Added ExecuteRegionFunction test


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

Branch: refs/heads/feature/GEODE-1571
Commit: ad9bec1c2c77d0fcc1c672ef9e5c96872c7c12d1
Parents: 0345bab
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Tue Jun 28 13:01:35 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Tue Jun 28 13:01:35 2016 -0700

----------------------------------------------------------------------
 ...xecuteRegionFunctionAuthDistributedTest.java | 60 ++++++++++++++++++++
 1 file changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ad9bec1c/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
new file mode 100644
index 0000000..ee5dff1
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientExecuteRegionFunctionAuthDistributedTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.security;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.ResultCollector;
+import com.gemstone.gemfire.internal.cache.functions.TestFunction;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class IntegratedClientExecuteRegionFunctionAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  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();
+    });
+  }
+}
+
+


[09/26] incubator-geode git commit: GEODE-1551: add ignoredExcpetions for CommandOverHttpDUnitTest

Posted by ji...@apache.org.
GEODE-1551: add ignoredExcpetions for CommandOverHttpDUnitTest


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

Branch: refs/heads/feature/GEODE-1571
Commit: e43ef7661871f3dd07366fe1815b26d391414710
Parents: 49d144b
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Tue Jun 28 11:09:11 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Tue Jun 28 11:09:11 2016 -0700

----------------------------------------------------------------------
 .../cli/commands/CliCommandTestBase.java        | 35 +++++++++++---------
 1 file changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e43ef766/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index ab2ce62..75d88aa 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -16,6 +16,22 @@
  */
 package com.gemstone.gemfire.management.internal.cli.commands;
 
+import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.management.ManagementService;
@@ -28,22 +44,8 @@ import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
 import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
 import com.gemstone.gemfire.management.internal.security.JSONAuthorization;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
 
 /**
  * Base class for all the CLI/gfsh command dunit tests.
@@ -155,6 +157,9 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
         JSONAuthorization.setUpWithJsonFile(jsonFile);
       }
 
+      IgnoredException.addIgnoredException("org.eclipse.jetty.io.EofException");
+      IgnoredException.addIgnoredException("java.nio.channels.ClosedChannelException");
+
       results[0] = jmxHost;
       results[1] = jmxPort;
       results[2] = httpPort;


[04/26] incubator-geode git commit: GEODE-1571: add utility method to simplify client cache creation

Posted by ji...@apache.org.
GEODE-1571: add utility method to simplify client cache creation


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

Branch: refs/heads/feature/GEODE-1571
Commit: eb3ce44da575601328c3ebe1ee4fbdf314379e3d
Parents: b43d026
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Mon Jun 27 14:53:46 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Jun 27 14:53:46 2016 -0700

----------------------------------------------------------------------
 ...ractIntegratedClientAuthDistributedTest.java | 29 +++++++++++---------
 ...tegratedClientGetAllAuthDistributedTest.java | 22 +++++----------
 ...ntegratedClientQueryAuthDistributedTest.java | 18 ++++++------
 3 files changed, 32 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eb3ce44d/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
index 5243bd5..a7ecb25 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/AbstractIntegratedClientAuthDistributedTest.java
@@ -17,23 +17,20 @@
 package com.gemstone.gemfire.security;
 
 import static com.gemstone.gemfire.distributed.ConfigurationProperties.*;
-import static com.gemstone.gemfire.test.dunit.Assert.fail;
-import static com.gemstone.gemfire.test.dunit.DistributedTestUtils.getDUnitLocatorPort;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
-import static com.gemstone.gemfire.test.dunit.NetworkUtils.getIPLiteral;
 import static org.assertj.core.api.Assertions.*;
 import static org.junit.Assert.*;
 
 import java.util.Properties;
 
-import com.gemstone.gemfire.cache.AttributesFactory;
+import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
+import org.junit.Before;
+
 import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
 import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.management.internal.security.JSONAuthorization;
 import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
@@ -42,10 +39,6 @@ import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 
-import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
-import org.junit.After;
-import org.junit.Before;
-
 public class AbstractIntegratedClientAuthDistributedTest extends JUnit4CacheTestCase {
 
   protected static final String REGION_NAME = "AuthRegion";
@@ -111,4 +104,14 @@ public class AbstractIntegratedClientAuthDistributedTest extends JUnit4CacheTest
     return props;
   }
 
+  protected ClientCache createClientCache(String username, String password, int serverPort){
+    ClientCache cache = new ClientCacheFactory(createClientProperties(username, password))
+      .setPoolSubscriptionEnabled(true)
+      .addPoolServer("localhost", serverPort)
+      .create();
+
+    cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+    return cache;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eb3ce44d/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
index f4b346d..792fa87 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetAllAuthDistributedTest.java
@@ -17,7 +17,7 @@
 package com.gemstone.gemfire.security;
 
 import static com.gemstone.gemfire.internal.Assert.assertTrue;
-import static org.jgroups.util.Util.assertEquals;
+import static org.jgroups.util.Util.*;
 
 import java.util.Arrays;
 import java.util.Map;
@@ -27,8 +27,6 @@ import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
-import com.gemstone.gemfire.cache.client.ClientCacheFactory;
-import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
@@ -36,24 +34,18 @@ public class IntegratedClientGetAllAuthDistributedTest extends AbstractIntegrate
 
   @Test
   public void testGetAll() {
-    client1.invoke("logging in super-user with correct password", () -> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
+    client1.invoke("logging in Stranger", () -> {
+      ClientCache cache = createClientCache("stranger", "1234567", serverPort);
 
-      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+      Region region = cache.getRegion(REGION_NAME);
       Map emptyMap = region.getAll(Arrays.asList("key1", "key2", "key3", "key4"));
       assertTrue(emptyMap.isEmpty());
     });
 
-    client2.invoke("logging in super-user with correct password", () -> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionReader", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
+    client2.invoke("logging in authRegionReader", () -> {
+      ClientCache cache = createClientCache("authRegionReader", "1234567", serverPort);
 
-      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+      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/incubator-geode/blob/eb3ce44d/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
index a484160..ad219cf 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/security/IntegratedClientQueryAuthDistributedTest.java
@@ -19,8 +19,8 @@ package com.gemstone.gemfire.security;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.query.CqAttributes;
@@ -35,8 +35,8 @@ public class IntegratedClientQueryAuthDistributedTest extends AbstractIntegrated
   @Test
   public void testQuery(){
     client1.invoke(()-> {
-      Cache cache = SecurityTestUtils.createCacheClient("stranger", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION);
-      final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      ClientCache cache = createClientCache("stranger", "1234567", serverPort);
+      final Region region = cache.getRegion(REGION_NAME);
 
       String query = "select * from /AuthRegion";
       assertNotAuthorized(()->region.query(query), "DATA:READ:AuthRegion");
@@ -50,8 +50,8 @@ public class IntegratedClientQueryAuthDistributedTest extends AbstractIntegrated
   public void testCQ(){
     String query = "select * from /AuthRegion";
     client1.invoke(()-> {
-      Cache cache = SecurityTestUtils.createCacheClient("stranger", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION);
-      Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      ClientCache cache =createClientCache("stranger", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
       Pool pool = PoolManager.find(region);
       QueryService qs = pool.getQueryService();
 
@@ -67,8 +67,8 @@ public class IntegratedClientQueryAuthDistributedTest extends AbstractIntegrated
     });
 
     client2.invoke(()-> {
-      Cache cache = SecurityTestUtils.createCacheClient("authRegionReader", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION);
-      Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      ClientCache cache =createClientCache("authRegionReader", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
       Pool pool = PoolManager.find(region);
       QueryService qs = pool.getQueryService();
 
@@ -82,8 +82,8 @@ public class IntegratedClientQueryAuthDistributedTest extends AbstractIntegrated
     });
 
     client3.invoke(()-> {
-      Cache cache = SecurityTestUtils.createCacheClient("super-user", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION);
-      Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      ClientCache cache =createClientCache("super-user", "1234567", serverPort);
+      Region region = cache.getRegion(REGION_NAME);
       Pool pool = PoolManager.find(region);
       QueryService qs = pool.getQueryService();
 


[25/26] incubator-geode git commit: GEODE-1571: rename ExternalSecurity to CustomSecurity

Posted by ji...@apache.org.
GEODE-1571: rename ExternalSecurity to CustomSecurity


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

Branch: refs/heads/feature/GEODE-1571
Commit: cd0d11abaf6b4b8ef5f91c2d06aed02bb3af175d
Parents: 1a92021
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Jun 30 12:07:38 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Jun 30 12:07:38 2016 -0700

----------------------------------------------------------------------
 .../internal/security/GeodeSecurityUtil.java    | 10 +++---
 .../security/shiro/CustomAuthRealm.java         | 12 +++----
 .../gemfire/security/CustomSecurity.java        | 32 ++++++++++++++++++
 .../gemfire/security/ExternalSecurity.java      | 34 --------------------
 .../templates/SampleJsonAuthorization.java      |  4 +--
 5 files changed, 45 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
index af1788a..a80e522 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/GeodeSecurityUtil.java
@@ -49,7 +49,7 @@ import com.gemstone.gemfire.internal.security.shiro.ShiroPrincipal;
 import com.gemstone.gemfire.management.internal.security.ResourceOperation;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.AuthenticationRequiredException;
-import com.gemstone.gemfire.security.ExternalSecurity;
+import com.gemstone.gemfire.security.CustomSecurity;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.security.GeodePermission;
 import com.gemstone.gemfire.security.GeodePermission.Operation;
@@ -313,9 +313,9 @@ public class GeodeSecurityUtil {
       SecurityUtils.setSecurityManager(securityManager);
     }
 
-    // only set up shiro realm if user has implemented ExternalSecurity
-    else if (authenticatorObject != null && authenticatorObject instanceof ExternalSecurity) {
-      ExternalSecurity authenticator = (ExternalSecurity) authenticatorObject;
+    // only set up shiro realm if user has implemented CustomSecurity
+    else if (authenticatorObject != null && authenticatorObject instanceof CustomSecurity) {
+      CustomSecurity authenticator = (CustomSecurity) authenticatorObject;
       authenticator.init(securityProps);
       Realm realm = new CustomAuthRealm(authenticator);
       SecurityManager securityManager = new DefaultSecurityManager(realm);
@@ -362,7 +362,7 @@ public class GeodeSecurityUtil {
 
   public static boolean isIntegratedSecurity(String authenticatorFactoryName) {
     Object auth = getObject(authenticatorFactoryName);
-    return (auth instanceof ExternalSecurity);
+    return (auth instanceof CustomSecurity);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
index cb3b116..dc7755e 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/security/shiro/CustomAuthRealm.java
@@ -33,7 +33,7 @@ import org.apache.shiro.subject.PrincipalCollection;
 
 import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.management.internal.security.ResourceConstants;
-import com.gemstone.gemfire.security.ExternalSecurity;
+import com.gemstone.gemfire.security.CustomSecurity;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 import com.gemstone.gemfire.security.GeodePermission;
 
@@ -41,9 +41,9 @@ public class CustomAuthRealm extends AuthorizingRealm{
   public static final String REALM_NAME = "CUSTOMAUTHREALM";
 
   private static final Logger logger = LogManager.getLogger(CustomAuthRealm.class);
-  private ExternalSecurity externalSecurity = null;
+  private CustomSecurity externalSecurity = null;
 
-  public CustomAuthRealm(ExternalSecurity auth) {
+  public CustomAuthRealm(CustomSecurity auth) {
     externalSecurity = auth;
   }
 
@@ -51,10 +51,10 @@ public class CustomAuthRealm extends AuthorizingRealm{
   public CustomAuthRealm (String authenticatorFactory) {
     Object auth = GeodeSecurityUtil.getObject(authenticatorFactory);
 
-    if(!(auth instanceof ExternalSecurity)){
-      throw new GemFireSecurityException("Integrated Security requires ExternalSecurity interface.");
+    if(!(auth instanceof CustomSecurity)){
+      throw new GemFireSecurityException("Integrated Security requires CustomSecurity interface.");
     }
-    externalSecurity = (ExternalSecurity) auth;
+    externalSecurity = (CustomSecurity) auth;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.java b/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.java
new file mode 100644
index 0000000..1e30902
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/CustomSecurity.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.gemstone.gemfire.security;
+
+import java.security.Principal;
+import java.util.Properties;
+
+public interface CustomSecurity {
+
+  void init(Properties securityProps);
+
+  Principal authenticate(Properties props) throws AuthenticationFailedException;
+
+  default boolean authorize(Principal principal, GeodePermission permission) {
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java b/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java
deleted file mode 100644
index 133eba2..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/ExternalSecurity.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.gemstone.gemfire.security;
-
-import java.security.Principal;
-import java.util.Properties;
-
-public interface ExternalSecurity {
-
-  void init(Properties securityProps);
-
-  Principal authenticate(Properties props) throws AuthenticationFailedException;
-
-  default boolean authorize(Principal principal, GeodePermission permission) {
-    return true;
-  }
-
-  //post-processing as well if we can find a good way to support it
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cd0d11ab/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
index a86c871..c69e4c6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
@@ -43,7 +43,7 @@ import com.gemstone.gemfire.management.internal.security.ResourceConstants;
 import com.gemstone.gemfire.security.AccessControl;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
-import com.gemstone.gemfire.security.ExternalSecurity;
+import com.gemstone.gemfire.security.CustomSecurity;
 import com.gemstone.gemfire.security.GeodePermission;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
@@ -95,7 +95,7 @@ import com.gemstone.gemfire.security.NotAuthorizedException;
  * }
  * </pre>
  */
-public class SampleJsonAuthorization implements ExternalSecurity {
+public class SampleJsonAuthorization implements CustomSecurity {
 
   public static class Role {
     List<GeodePermission> permissions = new ArrayList<>();


[08/26] incubator-geode git commit: Merge remote-tracking branch 'origin/feature/GEODE-1571' into feature/GEODE-1571

Posted by ji...@apache.org.
Merge remote-tracking branch 'origin/feature/GEODE-1571' into feature/GEODE-1571

# Conflicts:
#	geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java


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

Branch: refs/heads/feature/GEODE-1571
Commit: 0345bab11f5f48cf716407f0dee97af31f445eb3
Parents: 3483b11 6c16f6f
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Mon Jun 27 15:24:23 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Mon Jun 27 15:24:23 2016 -0700

----------------------------------------------------------------------
 ...ractIntegratedClientAuthDistributedTest.java | 29 +++++++++++---------
 ...tegratedClientGetAllAuthDistributedTest.java | 22 +++++----------
 ...ientPartitionAttrCmdAuthDistributedTest.java | 17 ++----------
 ...ntegratedClientQueryAuthDistributedTest.java | 18 ++++++------
 4 files changed, 34 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0345bab1/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
index edfa72a,b69e521..52c4a0c
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
@@@ -32,13 -29,8 +29,8 @@@ public class IntegratedClientGetClientP
  
    @Test
    public void testGetClientPartitionAttrCmd() {
 -    client1.invoke("logging in super-user with correct password", () -> {
 +    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);
+       ClientCache cache =createClientCache("stranger", "1234567", serverPort);
  
        assertNotAuthorized(() -> GetClientPartitionAttributesOp.execute((PoolImpl)cache.getDefaultPool(), REGION_NAME), "CLUSTER:READ");
      });


[17/26] incubator-geode git commit: Fixed a test - wrong user

Posted by ji...@apache.org.
Fixed a test - wrong user


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

Branch: refs/heads/feature/GEODE-1571
Commit: 3879310817c38ae35d8f72f0914069de29f1e10f
Parents: bad0a92
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Wed Jun 29 14:04:46 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Wed Jun 29 14:04:46 2016 -0700

----------------------------------------------------------------------
 .../security/IntegratedClientSizeAuthDistributedTest.java      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/38793108/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
index 96ea297..d0624a9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
@@ -34,9 +34,9 @@ public class IntegratedClientSizeAuthDistributedTest extends AbstractIntegratedC
   public void testSize() throws InterruptedException {
 
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567")).setPoolSubscriptionEnabled(true)
-                                                                                               .addPoolServer("localhost", serverPort)
-                                                                                               .create();
+      ClientCache cache = new ClientCacheFactory(createClientProperties("dataWriter", "1234567")).setPoolSubscriptionEnabled(true)
+                                                                                                 .addPoolServer("localhost", serverPort)
+                                                                                                 .create();
 
       assertNotAuthorized(() -> SizeOp.execute((InternalPool) cache.getDefaultPool(), REGION_NAME), "DATA:READ:AuthRegion");
     });


[06/26] incubator-geode git commit: GEODE-1571: add utility method to simplify client cache creation

Posted by ji...@apache.org.
GEODE-1571: add utility method to simplify client cache creation


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

Branch: refs/heads/feature/GEODE-1571
Commit: 6c16f6f2bcbc3512ba995d3f1842a2fde63c115c
Parents: cfbcba1
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Mon Jun 27 15:11:47 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Mon Jun 27 15:11:47 2016 -0700

----------------------------------------------------------------------
 ...ientPartitionAttrCmdAuthDistributedTest.java | 23 ++++----------------
 1 file changed, 4 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6c16f6f2/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
index fbbdc05..b69e521 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest.java
@@ -16,42 +16,27 @@
  */
 package com.gemstone.gemfire.security;
 
-import java.util.Arrays;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.ClientCache;
-import com.gemstone.gemfire.cache.client.ClientCacheFactory;
-import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.client.internal.GetClientPartitionAttributesOp;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 @Category(DistributedTest.class)
 public class IntegratedClientGetClientPartitionAttrCmdAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
   public void testGetClientPartitionAttrCmd() {
     client1.invoke("logging in super-user with correct password", () -> {
-      ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
-
-      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+      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 = new ClientCacheFactory(createClientProperties("super-user", "1234567"))
-        .setPoolSubscriptionEnabled(true)
-        .addPoolServer("localhost", serverPort)
-        .create();
-
-      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
+      ClientCache cache = createClientCache("super-user", "1234567", serverPort);
 
       GetClientPartitionAttributesOp.execute((PoolImpl)cache.getDefaultPool(), REGION_NAME);
     });


[16/26] incubator-geode git commit: Added Size test and refactored Size

Posted by ji...@apache.org.
Added Size test and refactored Size


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

Branch: refs/heads/feature/GEODE-1571
Commit: bad0a92d3868a39d9e1d2f01eff0c59f13c736c3
Parents: b782b6b
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Wed Jun 29 11:04:33 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Wed Jun 29 11:04:33 2016 -0700

----------------------------------------------------------------------
 .../cache/tier/sockets/command/Size.java        | 141 ++++++++-----------
 ...IntegratedClientSizeAuthDistributedTest.java |  57 ++++++++
 2 files changed, 115 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bad0a92d/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
index 64aee67..8b11d3d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/command/Size.java
@@ -15,20 +15,15 @@
  * limitations under the License.
  */
 /**
- * 
+ *
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets.command;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 
-import com.gemstone.gemfire.cache.EntryNotFoundException;
 import com.gemstone.gemfire.cache.RegionDestroyedException;
 import com.gemstone.gemfire.distributed.internal.DistributionStats;
-import com.gemstone.gemfire.i18n.LogWriterI18n;
-import com.gemstone.gemfire.internal.cache.EventID;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.tier.CachedRegionHelper;
 import com.gemstone.gemfire.internal.cache.tier.Command;
 import com.gemstone.gemfire.internal.cache.tier.MessageType;
@@ -39,6 +34,7 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.Part;
 import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
+import com.gemstone.gemfire.internal.security.GeodeSecurityUtil;
 import com.gemstone.gemfire.security.GemFireSecurityException;
 
 
@@ -46,56 +42,60 @@ public class Size extends BaseCommand {
 
   private final static Size singleton = new Size();
 
+  private Size() {
+  }
+
   public static Command getCommand() {
     return singleton;
   }
 
-  private Size() {
+  private static void writeSizeResponse(Integer sizeCount, Message origMsg, ServerConnection servConn)
+    throws IOException {
+    Message responseMsg = servConn.getResponseMessage();
+    responseMsg.setMessageType(MessageType.RESPONSE);
+    responseMsg.setNumberOfParts(1);
+    responseMsg.setTransactionId(origMsg.getTransactionId());
+    responseMsg.addObjPart(sizeCount);
+    responseMsg.send(servConn);
   }
 
   @Override
-  public void cmdExecute(Message msg, ServerConnection servConn, long start)
-      throws IOException, InterruptedException {
-    Part regionNamePart = null, keyPart = null, callbackArgPart = null;
-    String regionName = null;
-    Part eventPart = null;
-    StringBuffer errMessage = new StringBuffer();
+  public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException, InterruptedException {
+    StringBuilder errMessage = new StringBuilder();
     CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
     CacheServerStats stats = servConn.getCacheServerStats();
     servConn.setAsTrue(REQUIRES_RESPONSE);
 
-    {
-      long oldStart = start;
-      start = DistributionStats.getStatTime();
-      stats.incReadSizeRequestTime(start - oldStart);
-    }
+    long oldStart = start;
+    start = DistributionStats.getStatTime();
+    stats.incReadSizeRequestTime(start - oldStart);
     // Retrieve the data from the message parts
-    regionNamePart = msg.getPart(0);
-    regionName = regionNamePart.getString();
-    
+    Part regionNamePart = msg.getPart(0);
+    String regionName = regionNamePart.getString();
+
     if (regionName == null) {
       logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand__THE_INPUT_REGION_NAME_FOR_THE_0_REQUEST_IS_NULL, "size"));
-      errMessage
-            .append(LocalizedStrings.BaseCommand__THE_INPUT_REGION_NAME_FOR_THE_0_REQUEST_IS_NULL.toLocalizedString("size"));
-      writeErrorResponse(msg, MessageType.SIZE_ERROR, errMessage
-          .toString(), servConn);
+      errMessage.append(LocalizedStrings.BaseCommand__THE_INPUT_REGION_NAME_FOR_THE_0_REQUEST_IS_NULL.toLocalizedString("size"));
+      writeErrorResponse(msg, MessageType.SIZE_ERROR, errMessage.toString(), servConn);
       servConn.setAsTrue(RESPONDED);
+      return;
+    }
+
+    LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
+    if (region == null) {
+      String reason = LocalizedStrings.BaseCommand__0_WAS_NOT_FOUND_DURING_1_REQUEST.toLocalizedString(regionName, "size");
+      writeRegionDestroyedEx(msg, regionName, reason, servConn);
+      servConn.setAsTrue(RESPONDED);
+      return;
     }
-    else {
-      LocalRegion region = (LocalRegion)crHelper.getRegion(regionName);
-      if (region == null) {
-        String reason = LocalizedStrings.BaseCommand__0_WAS_NOT_FOUND_DURING_1_REQUEST.toLocalizedString(regionName,"size");
-        writeRegionDestroyedEx(msg, regionName, reason, servConn);
-        servConn.setAsTrue(RESPONDED);
-      }
-      else {
-        // Size the entry
 
-        try {
+    GeodeSecurityUtil.authorizeRegionRead(regionName);
+    // Size the entry
+    try {
           /*
-           * 
+           *
            * txtodo: doesn't seem like there is any notion of authzSize
-           * 
+           *
           AuthorizeRequest authzRequest = servConn.getAuthzRequest();
           if (authzRequest != null) {
             // TODO SW: This is to handle DynamicRegionFactory destroy
@@ -113,55 +113,30 @@ public class Size extends BaseCommand {
             }
           }
           */
-          writeSizeResponse(region.size(), msg, servConn);
-          servConn.setAsTrue(RESPONDED);
-          return;
-        }
-        catch (RegionDestroyedException rde) {
-          writeException(msg, rde, false, servConn);
-          servConn.setAsTrue(RESPONDED);
-          return;
-        }
-        catch (Exception e) {
-          // If an interrupted exception is thrown , rethrow it
-          checkForInterrupt(servConn, e);
+      writeSizeResponse(region.size(), msg, servConn);
+    } catch (RegionDestroyedException rde) {
+      writeException(msg, rde, false, servConn);
+    } catch (Exception e) {
+      // If an interrupted exception is thrown , rethrow it
+      checkForInterrupt(servConn, e);
 
-          // If an exception occurs during the destroy, preserve the connection
-          writeException(msg, e, false, servConn);
-          servConn.setAsTrue(RESPONDED);
-          if (e instanceof GemFireSecurityException) {
-            // Fine logging for security exceptions since these are already
-            // logged by the security logger
-            if (logger.isDebugEnabled())
-              logger.debug("{}: Unexpected Security exception", servConn.getName(), e);
-          }
-          else {
-            logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION, servConn.getName()), e); 
-          }
-          servConn.setAsTrue(RESPONDED);
-          return;
-        } finally {
-          if (logger.isDebugEnabled()) {
-            logger.debug("{}: Sent size response for region {}", servConn.getName(), regionName);
-          }
-          stats.incWriteSizeResponseTime(DistributionStats.getStatTime()
-            - start);
+      // If an exception occurs during the destroy, preserve the connection
+      writeException(msg, e, false, servConn);
+      if (e instanceof GemFireSecurityException) {
+        // Fine logging for security exceptions since these are already
+        // logged by the security logger
+        if (logger.isDebugEnabled()) {
+          logger.debug("{}: Unexpected Security exception", servConn.getName(), e);
         }
+      } else {
+        logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION, servConn.getName()), e);
+      }
+    } finally {
+      if (logger.isDebugEnabled()) {
+        logger.debug("{}: Sent size response for region {}", servConn.getName(), regionName);
       }
+      servConn.setAsTrue(RESPONDED);
+      stats.incWriteSizeResponseTime(DistributionStats.getStatTime() - start);
     }
-    
-    
-
   }
-  
-  private static void writeSizeResponse(Integer sizeCount, Message origMsg,
-      ServerConnection servConn) throws IOException {
-    Message responseMsg = servConn.getResponseMessage();
-    responseMsg.setMessageType(MessageType.RESPONSE);
-    responseMsg.setNumberOfParts(1);
-    responseMsg.setTransactionId(origMsg.getTransactionId());
-    responseMsg.addObjPart(sizeCount);
-    responseMsg.send(servConn);
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bad0a92d/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
new file mode 100644
index 0000000..96ea297
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientSizeAuthDistributedTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.security;
+
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.internal.InternalPool;
+import com.gemstone.gemfire.cache.client.internal.SizeOp;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class IntegratedClientSizeAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
+
+  @Test
+  public void testSize() throws InterruptedException {
+
+    AsyncInvocation ai1 = client1.invokeAsync(() -> {
+      ClientCache cache = new ClientCacheFactory(createClientProperties("stranger", "1234567")).setPoolSubscriptionEnabled(true)
+                                                                                               .addPoolServer("localhost", serverPort)
+                                                                                               .create();
+
+      assertNotAuthorized(() -> SizeOp.execute((InternalPool) cache.getDefaultPool(), REGION_NAME), "DATA:READ:AuthRegion");
+    });
+
+    AsyncInvocation ai2 = client2.invokeAsync(() -> {
+      ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionReader", "1234567")).setPoolSubscriptionEnabled(true)
+                                                                                                       .addPoolServer("localhost", serverPort)
+                                                                                                       .create();
+
+      SizeOp.execute((InternalPool) cache.getDefaultPool(), REGION_NAME);
+    });
+
+    ai1.join();
+    ai2.join();
+    ai1.checkException();
+    ai2.checkException();
+  }
+}


[15/26] incubator-geode git commit: GEODE-1598: avoid deletion of options during GFSH autocomplete

Posted by ji...@apache.org.
GEODE-1598: avoid deletion of options during GFSH autocomplete

* This closes #175


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

Branch: refs/heads/feature/GEODE-1571
Commit: b5a50fe782231cc3521260b52952bc1bb146fa66
Parents: e43ef76
Author: gmeilen <gr...@gmail.com>
Authored: Tue Jun 28 12:20:52 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Tue Jun 28 14:31:12 2016 -0700

----------------------------------------------------------------------
 .../gemfire/management/internal/cli/GfshParser.java    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b5a50fe7/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
index 4d2564f..7fc7295 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
@@ -336,8 +336,19 @@ public class GfshParser implements Parser {
       boolean warningValueRequired = false;
       Option warningOption = null;
 
+      boolean updatedDesiredCursorPosition = false;
+      if (!userOptionSet.areOptionsPresent()) {
+        int walkBackwards = remainingBuffer.length() - 1;
+        while (remainingBuffer.charAt(walkBackwards) != '-') {
+          walkBackwards--;
+        }
+        walkBackwards -= 2;
+        desiredCursorPosition += walkBackwards;
+        updatedDesiredCursorPosition = true;
+      }
+
       for (Option option : commandTarget.getOptionParser().getOptions()) {
-        if (userOptionSet.hasOption(option)) {
+        if (!updatedDesiredCursorPosition && userOptionSet.hasOption(option)) {
           // We are supporting option synonyms,
           // so we need to check that here
           for (String string : userOptionSet.getSplit()) {


[24/26] incubator-geode git commit: Merge branch 'develop' into feature/GEODE-1571

Posted by ji...@apache.org.
Merge branch 'develop' into feature/GEODE-1571


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

Branch: refs/heads/feature/GEODE-1571
Commit: 1a92021c9642937f459504e9accfb16b0a4d8fa0
Parents: aa2007b 186a09a
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Jun 30 12:02:19 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Thu Jun 30 12:02:19 2016 -0700

----------------------------------------------------------------------
 .../distributed/internal/ResourceEvent.java     |   4 +-
 .../gemfire/internal/cache/AbstractRegion.java  |   4 +-
 .../gemfire/internal/cache/CacheService.java    |   7 +
 .../internal/cache/GemFireCacheImpl.java        |   1 +
 .../gemfire/internal/cache/TXManagerImpl.java   |  11 +-
 .../gemfire/management/JMXNotificationType.java |   7 +
 .../management/internal/MBeanJMXAdapter.java    |   5 +
 .../internal/ManagementConstants.java           |   8 +-
 .../internal/beans/CacheServiceMBeanBase.java   |  24 +++
 .../internal/beans/ManagementAdapter.java       |  30 +++-
 .../internal/beans/ManagementListener.java      |   7 +-
 .../management/internal/cli/GfshParser.java     |  13 +-
 .../gemfire/cache/ConnectionPoolDUnitTest.java  |   2 -
 .../pooling/ConnectionManagerJUnitTest.java     |   2 -
 .../query/dunit/QueryUsingPoolDUnitTest.java    |   2 -
 .../cache30/ClientMembershipDUnitTest.java      |   2 -
 .../gemfire/distributed/LocatorDUnitTest.java   |   2 -
 .../LocatorLoadSnapshotIntegrationTest.java     |   2 -
 ...hreadPoolExecutorWithKeepAliveJUnitTest.java |   1 -
 .../internal/cache/MockCacheServiceImpl.java    |   6 +
 .../internal/cache/SingleHopStatsDUnitTest.java |   2 -
 ...ersalMembershipListenerAdapterDUnitTest.java |   2 -
 .../cli/commands/CliCommandTestBase.java        |  35 ++--
 .../com/gemstone/gemfire/test/fake/Fakes.java   |  17 ++
 .../cq/dunit/CqPerfUsingPoolDUnitTest.java      |   2 -
 .../cli/commands/ClientCommandsDUnitTest.java   |   1 -
 .../security/ClientAuthzObjectModDUnitTest.java |   2 -
 .../cache/lucene/internal/IndexListener.java    |  35 ++++
 .../cache/lucene/internal/LuceneIndexStats.java |  41 ++++-
 .../lucene/internal/LuceneServiceImpl.java      |   9 +-
 .../internal/PartitionedRepositoryManager.java  |  47 +++---
 .../internal/management/LuceneIndexMetrics.java | 161 +++++++++++++++++++
 .../management/LuceneServiceBridge.java         |  82 ++++++++++
 .../internal/management/LuceneServiceMBean.java |  57 +++++++
 .../management/LuceneServiceMXBean.java         |  58 +++++++
 .../internal/repository/IndexRepository.java    |   5 +
 .../repository/IndexRepositoryImpl.java         |  15 +-
 .../internal/LuceneIndexStatsJUnitTest.java     |   6 +-
 .../PartitionedRepositoryManagerJUnitTest.java  |  40 +++--
 .../IndexRepositoryImplJUnitTest.java           |   9 +-
 .../cache/CacheXml70GatewayDUnitTest.java       |   2 -
 .../cache/wan/CacheClientNotifierDUnitTest.java |   1 -
 ...ersistenceEnabledGatewaySenderDUnitTest.java |   2 -
 43 files changed, 673 insertions(+), 98 deletions(-)
----------------------------------------------------------------------



[11/26] incubator-geode git commit: GEODE-1571: rework SamplePostProcessor

Posted by ji...@apache.org.
GEODE-1571: rework SamplePostProcessor


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

Branch: refs/heads/feature/GEODE-1571
Commit: 07d0817aa4292de8ed6302147e510c56bb6bffff
Parents: 0345bab
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Tue Jun 28 10:31:41 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Tue Jun 28 12:14:08 2016 -0700

----------------------------------------------------------------------
 .../gemfire/security/templates/SamplePostProcessor.java        | 2 +-
 .../internal/security/GfshCommandsPostProcessorTest.java       | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/07d0817a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
index 1adfb9f..87a4e3c 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SamplePostProcessor.java
@@ -39,6 +39,6 @@ public class SamplePostProcessor implements PostProcessor{
                                    String regionPath,
                                    Object key,
                                    Object value) {
-    return MASK;
+    return principal.getName()+"/"+regionPath+"/"+key+"/"+value;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/07d0817a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
index 2cfd496..d651b9a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/GfshCommandsPostProcessorTest.java
@@ -61,10 +61,12 @@ public class GfshCommandsPostProcessorTest {
 
     // for get command, assert the return value is processed
     gfsh.executeCommand("get --region=region1 --key=key1");
-    assertTrue(gfsh.outputString.contains("Value       : ****"), gfsh.outputString);
+    assertTrue(gfsh.outputString.contains("data-user/region1/key1/value1"), gfsh.outputString);
 
     // for query command, assert the return values are processed
     gfsh.executeCommand("query --query=\"select * from /region1\"");
-    assertTrue(gfsh.outputString.contains("****\n****\n****"), gfsh.outputString);
+    assertTrue(gfsh.outputString.contains("data-user/null/null/value1"), gfsh.outputString);
+    assertTrue(gfsh.outputString.contains("data-user/null/null/value2"), gfsh.outputString);
+    assertTrue(gfsh.outputString.contains("data-user/null/null/value3"), gfsh.outputString);
   }
 }


[21/26] incubator-geode git commit: GEODE-1607: Fix ConcurrentModificationException during cache close

Posted by ji...@apache.org.
GEODE-1607: Fix ConcurrentModificationException during cache close


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

Branch: refs/heads/feature/GEODE-1571
Commit: 186a09a74b202a4943ced37eddd258e7906d117f
Parents: ee05774
Author: eshu <es...@pivotal.io>
Authored: Thu Jun 30 11:11:28 2016 -0700
Committer: eshu <es...@pivotal.io>
Committed: Thu Jun 30 11:12:59 2016 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/internal/cache/TXManagerImpl.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/186a09a7/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
index 1512234..dc668eb 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/TXManagerImpl.java
@@ -583,8 +583,15 @@ public class TXManagerImpl implements CacheTransactionManager,
     if (isClosed()) {
       return;
     }
-    this.closed = true;
-    for (TXStateProxy proxy: this.hostedTXStates.values()) {
+    TXStateProxy[] proxies = null;
+    synchronized (this.hostedTXStates) {
+      //After this, newly added TXStateProxy would not operate on the TXState.
+      this.closed = true;
+      
+      proxies = this.hostedTXStates.values().toArray(new TXStateProxy[this.hostedTXStates.size()]);      
+    }
+    
+    for (TXStateProxy proxy: proxies) {
       proxy.getLock().lock();
       try {
         proxy.close();


[18/26] incubator-geode git commit: GEODE-11: Cleaning up old IndexRepositoryImpls when buckets move

Posted by ji...@apache.org.
GEODE-11: Cleaning up old IndexRepositoryImpls when buckets move

When a bucket is moved, we leave the IndexRepositoryImpl open. But even
after the bucket moves back, we just dereference the old
IndexRepositoryImpl without closing it. We should make sure we always
invoke close on the IndexRepositoryImpl to clean up any resources the
IndexWriter is using.


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

Branch: refs/heads/feature/GEODE-1571
Commit: 63ce3c0f4828f4af11e6c354d228c42ea0226b49
Parents: b5a50fe
Author: Dan Smith <up...@apache.org>
Authored: Wed Jun 15 13:58:31 2016 -0700
Committer: Dan Smith <up...@apache.org>
Committed: Wed Jun 29 14:46:59 2016 -0700

----------------------------------------------------------------------
 .../gemfire/internal/cache/AbstractRegion.java  |  4 +-
 .../com/gemstone/gemfire/test/fake/Fakes.java   | 17 +++++++
 .../cache/lucene/internal/LuceneIndexStats.java |  2 +-
 .../internal/PartitionedRepositoryManager.java  | 47 +++++++++++---------
 .../internal/repository/IndexRepository.java    |  5 +++
 .../repository/IndexRepositoryImpl.java         | 15 ++++++-
 .../internal/LuceneIndexStatsJUnitTest.java     |  6 +--
 .../PartitionedRepositoryManagerJUnitTest.java  | 40 ++++++++++-------
 .../IndexRepositoryImplJUnitTest.java           |  9 +++-
 9 files changed, 98 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
index 95854ec..2d44979 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractRegion.java
@@ -276,13 +276,13 @@ public abstract class AbstractRegion implements Region, RegionAttributes,
     return destroy(key, null);
   }
 
-  public final Object get(Object name) throws CacheLoaderException,
+  public Object get(Object name) throws CacheLoaderException,
       TimeoutException
   {
     return get(name, null, true, null);
   }
 
-  public final Object put(Object name, Object value) throws TimeoutException,
+  public Object put(Object name, Object value) throws TimeoutException,
       CacheWriterException
   {
     return put(name, value, null);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java b/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
index 323c281..c3b1a0e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/fake/Fakes.java
@@ -28,10 +28,13 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.DistributionManager;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.internal.cache.AbstractRegion;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 
 import java.io.File;
 import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
 
 import static org.mockito.Mockito.*;
 
@@ -123,6 +126,20 @@ public class Fakes {
     return region;
   }
 
+  /**
+   * Add real map behavior to a mock region. Useful for tests
+   * where you want to mock region that just behaves like a map.
+   * @param mock the mockito mock to add behavior too.
+   */
+  public static void addMapBehavior(Region mock) {
+    //Allow the region to behave like a fake map
+    Map underlyingMap = new HashMap();
+    when(mock.get(any()))
+      .then(invocation -> underlyingMap.get(invocation.getArguments()[0]));
+    when(mock.put(any(), any()))
+      .then(invocation -> underlyingMap.put(invocation.getArguments()[0], invocation.getArguments()[1]));
+  }
+
   private Fakes() {
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
index ea1f35e..8e2d97c 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStats.java
@@ -138,7 +138,7 @@ public class LuceneIndexStats {
     stats.incInt(commitsId, 1);
   }
 
-  public void addDocumentsSuppplier(IntSupplier supplier) {
+  public void addDocumentsSupplier(IntSupplier supplier) {
     this.documentsSuppliers.add(supplier);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
index 25010b0..a119157 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.index.IndexWriter;
@@ -60,7 +61,7 @@ public class PartitionedRepositoryManager implements RepositoryManager {
    * 
    * It is weak so that the old BucketRegion will be garbage collected. 
    */
-  CopyOnWriteHashMap<Integer, IndexRepository> indexRepositories = new CopyOnWriteHashMap<Integer, IndexRepository>();
+  private final ConcurrentHashMap<Integer, IndexRepository> indexRepositories = new ConcurrentHashMap<Integer, IndexRepository>();
   
   /** The user region for this index */
   private final PartitionedRegion userRegion;
@@ -128,45 +129,49 @@ public class PartitionedRepositoryManager implements RepositoryManager {
    */
   private IndexRepository getRepository(Integer bucketId) throws BucketNotFoundException {
     IndexRepository repo = indexRepositories.get(bucketId);
-    
-    //Remove the repository if it has been destroyed (due to rebalancing)
-    if(repo != null && repo.isClosed()) {
-      indexRepositories.remove(bucketId, repo);
-      repo = null;
+    if(repo != null && !repo.isClosed()) {
+      return repo;
     }
-    
-    if(repo == null) {
+
+    repo = indexRepositories.compute(bucketId, (key, oldRepository) -> {
+      if(oldRepository != null && !oldRepository.isClosed()) {
+        return oldRepository;
+      }
+      if(oldRepository != null) {
+        oldRepository.cleanup();
+      }
+
       try {
         BucketRegion fileBucket = getMatchingBucket(fileRegion, bucketId);
         BucketRegion chunkBucket = getMatchingBucket(chunkRegion, bucketId);
+        if(fileBucket == null || chunkBucket == null) {
+          return null;
+        }
         RegionDirectory dir = new RegionDirectory(fileBucket, chunkBucket, fileSystemStats);
         IndexWriterConfig config = new IndexWriterConfig(analyzer);
         IndexWriter writer = new IndexWriter(dir, config);
-        repo = new IndexRepositoryImpl(fileBucket, writer, serializer, indexStats);
-        IndexRepository oldRepo = indexRepositories.putIfAbsent(bucketId, repo);
-        if(oldRepo != null) {
-          repo = oldRepo;
-        }
+        return new IndexRepositoryImpl(fileBucket, writer, serializer, indexStats);
+
       } catch(IOException e) {
         throw new InternalGemFireError("Unable to create index repository", e);
       }
+
+    });
+
+    if(repo == null) {
+      throw new BucketNotFoundException("Colocated index buckets not found for regions " + chunkRegion + ", " + fileRegion + " bucket id " + bucketId);
     }
-    
+
     return repo;
   }
 
   /**
    * Find the bucket in region2 that matches the bucket id from region1.
    */
-  private BucketRegion getMatchingBucket(PartitionedRegion region, Integer bucketId) throws BucketNotFoundException {
+  private BucketRegion getMatchingBucket(PartitionedRegion region, Integer bucketId) {
     //Force the bucket to be created if it is not already
     region.getOrCreateNodeForBucketWrite(bucketId, null);
     
-    BucketRegion result = region.getDataStore().getLocalBucketById(bucketId);
-    if(result == null) {
-      throw new BucketNotFoundException("Bucket not found for region " + region + " bucekt id " + bucketId);
-    }
-    
-    return result;
+    return region.getDataStore().getLocalBucketById(bucketId);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java
index fab2c2a..e487884 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepository.java
@@ -81,4 +81,9 @@ public interface IndexRepository {
    * For debugging purposes, return the underlying IndexWriter
    */
   IndexWriter getWriter();
+
+  /**
+   * Clean up any resources associated with this index repository.
+   */
+  void cleanup();
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java
index 110f85a..563e382 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImpl.java
@@ -48,6 +48,7 @@ public class IndexRepositoryImpl implements IndexRepository {
   private final SearcherManager searcherManager;
   private Region<?,?> region;
   private LuceneIndexStats stats;
+  private DocumentCountSupplier documentCountSupplier;
 
   private static final Logger logger = LogService.getLogger();
   
@@ -57,7 +58,8 @@ public class IndexRepositoryImpl implements IndexRepository {
     searcherManager = new SearcherManager(writer, APPLY_ALL_DELETES, true, null);
     this.serializer = serializer;
     this.stats = stats;
-    stats.addDocumentsSuppplier(new DocumentCountSupplier());
+    documentCountSupplier = new DocumentCountSupplier();
+    stats.addDocumentsSupplier(documentCountSupplier);
   }
 
   @Override
@@ -148,6 +150,17 @@ public class IndexRepositoryImpl implements IndexRepository {
     return region.isDestroyed();
   }
 
+  @Override
+  public void cleanup() {
+    stats.removeDocumentsSupplier(documentCountSupplier);
+    try {
+      writer.close();
+    }
+    catch (IOException e) {
+      logger.warn("Unable to clean up index repository", e);
+    }
+  }
+
   private class DocumentCountSupplier implements IntSupplier {
     @Override
     public int getAsInt() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStatsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStatsJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStatsJUnitTest.java
index 05e64af..6f2f411 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStatsJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexStatsJUnitTest.java
@@ -26,8 +26,6 @@ import java.util.function.IntSupplier;
 import com.gemstone.gemfire.Statistics;
 import com.gemstone.gemfire.StatisticsFactory;
 import com.gemstone.gemfire.StatisticsType;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystemJUnitTest;
-import com.gemstone.gemfire.management.internal.cli.parser.Argument;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 import org.junit.Before;
@@ -94,8 +92,8 @@ public class LuceneIndexStatsJUnitTest {
 
   @Test
   public void shouldPollSuppliersForDocumentStat() {
-    stats.addDocumentsSuppplier(() -> 5);
-    stats.addDocumentsSuppplier(() -> 3);
+    stats.addDocumentsSupplier(() -> 5);
+    stats.addDocumentsSupplier(() -> 3);
 
     int documentsId = type.nameToId("documents");
     ArgumentCaptor<IntSupplier> documentsSupplierCaptor = ArgumentCaptor.forClass(IntSupplier.class);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
index ec56381..2221a6d 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
@@ -20,6 +20,7 @@ package com.gemstone.gemfire.cache.lucene.internal;
 
 import static org.junit.Assert.*;
 import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.when;
 
 import java.io.IOException;
 import java.util.Arrays;
@@ -51,6 +52,7 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion.RetryTimeKeeper;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionDataStore;
 import com.gemstone.gemfire.internal.cache.execute.InternalRegionFunctionContext;
+import com.gemstone.gemfire.test.fake.Fakes;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
@@ -73,14 +75,14 @@ public class PartitionedRepositoryManagerJUnitTest {
   public void setUp() {
     userRegion = Mockito.mock(PartitionedRegion.class);
     userDataStore = Mockito.mock(PartitionedRegionDataStore.class);
-    Mockito.when(userRegion.getDataStore()).thenReturn(userDataStore);
+    when(userRegion.getDataStore()).thenReturn(userDataStore);
     
     fileRegion = Mockito.mock(PartitionedRegion.class);
     fileDataStore = Mockito.mock(PartitionedRegionDataStore.class);
-    Mockito.when(fileRegion.getDataStore()).thenReturn(fileDataStore);
+    when(fileRegion.getDataStore()).thenReturn(fileDataStore);
     chunkRegion = Mockito.mock(PartitionedRegion.class);
     chunkDataStore = Mockito.mock(PartitionedRegionDataStore.class);
-    Mockito.when(chunkRegion.getDataStore()).thenReturn(chunkDataStore);
+    when(chunkRegion.getDataStore()).thenReturn(chunkDataStore);
     serializer = new HeterogeneousLuceneSerializer(new String[] {"a", "b"} );
     indexStats = Mockito.mock(LuceneIndexStats.class);
     fileSystemStats = Mockito.mock(FileSystemStats.class);
@@ -112,7 +114,7 @@ public class PartitionedRepositoryManagerJUnitTest {
    * Test what happens when a bucket is destroyed.
    */
   @Test
-  public void destroyBucket() throws BucketNotFoundException, IOException {
+  public void destroyBucketShouldCreateNewIndexRepository() throws BucketNotFoundException, IOException {
     PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion, fileRegion, chunkRegion, serializer, new StandardAnalyzer(),
       indexStats, fileSystemStats);
     
@@ -127,12 +129,14 @@ public class PartitionedRepositoryManagerJUnitTest {
     
     //Simulate rebalancing of a bucket by marking the old bucket is destroyed
     //and creating a new bucket
-    Mockito.when(fileBucket0.isDestroyed()).thenReturn(true);
+    when(fileBucket0.isDestroyed()).thenReturn(true);
     setUpMockBucket(0);
     
     IndexRepositoryImpl newRepo0 = (IndexRepositoryImpl) repoManager.getRepository(userRegion, 0, null);
     assertNotEquals(repo0, newRepo0);
     checkRepository(newRepo0, 0);
+    assertTrue(repo0.isClosed());
+    assertFalse(repo0.getWriter().isOpen());
   }
   
   /**
@@ -151,12 +155,12 @@ public class PartitionedRepositoryManagerJUnitTest {
       indexStats, fileSystemStats);
     setUpMockBucket(0);
     
-    Mockito.when(fileDataStore.getLocalBucketById(eq(0))).thenReturn(null);
+    when(fileDataStore.getLocalBucketById(eq(0))).thenReturn(null);
     
-    Mockito.when(fileRegion.getOrCreateNodeForBucketWrite(eq(0), (RetryTimeKeeper) any())).then(new Answer() {
+    when(fileRegion.getOrCreateNodeForBucketWrite(eq(0), (RetryTimeKeeper) any())).then(new Answer() {
       @Override
       public Object answer(InvocationOnMock invocation) throws Throwable {
-        Mockito.when(fileDataStore.getLocalBucketById(eq(0))).thenReturn(fileBuckets.get(0));
+        when(fileDataStore.getLocalBucketById(eq(0))).thenReturn(fileBuckets.get(0));
         return null;
       }
     });
@@ -174,7 +178,7 @@ public class PartitionedRepositoryManagerJUnitTest {
 
     Set<Integer> buckets = new LinkedHashSet<Integer>(Arrays.asList(0, 1));
     InternalRegionFunctionContext ctx = Mockito.mock(InternalRegionFunctionContext.class);
-    Mockito.when(ctx.getLocalBucketSet((any()))).thenReturn(buckets);
+    when(ctx.getLocalBucketSet((any()))).thenReturn(buckets);
     Collection<IndexRepository> repos = repoManager.getRepositories(ctx);
     assertEquals(2, repos.size());
 
@@ -203,7 +207,7 @@ public class PartitionedRepositoryManagerJUnitTest {
     Set<Integer> buckets = new LinkedHashSet<Integer>(Arrays.asList(0, 1));
 
     InternalRegionFunctionContext ctx = Mockito.mock(InternalRegionFunctionContext.class);
-    Mockito.when(ctx.getLocalBucketSet((any()))).thenReturn(buckets);
+    when(ctx.getLocalBucketSet((any()))).thenReturn(buckets);
     repoManager.getRepositories(ctx);
   }
   
@@ -218,14 +222,16 @@ public class PartitionedRepositoryManagerJUnitTest {
   private BucketRegion setUpMockBucket(int id) {
     BucketRegion mockBucket = Mockito.mock(BucketRegion.class);
     BucketRegion fileBucket = Mockito.mock(BucketRegion.class);
+    //Allowing the fileBucket to behave like a map so that the IndexWriter operations don't fail
+    Fakes.addMapBehavior(fileBucket);
     BucketRegion chunkBucket = Mockito.mock(BucketRegion.class);
-    Mockito.when(mockBucket.getId()).thenReturn(id);
-    Mockito.when(userRegion.getBucketRegion(eq(id), eq(null))).thenReturn(mockBucket);
-    Mockito.when(userDataStore.getLocalBucketById(eq(id))).thenReturn(mockBucket);
-    Mockito.when(userRegion.getBucketRegion(eq(id + 113), eq(null))).thenReturn(mockBucket);
-    Mockito.when(userDataStore.getLocalBucketById(eq(id + 113))).thenReturn(mockBucket);
-    Mockito.when(fileDataStore.getLocalBucketById(eq(id))).thenReturn(fileBucket);
-    Mockito.when(chunkDataStore.getLocalBucketById(eq(id))).thenReturn(chunkBucket);
+    when(mockBucket.getId()).thenReturn(id);
+    when(userRegion.getBucketRegion(eq(id), eq(null))).thenReturn(mockBucket);
+    when(userDataStore.getLocalBucketById(eq(id))).thenReturn(mockBucket);
+    when(userRegion.getBucketRegion(eq(id + 113), eq(null))).thenReturn(mockBucket);
+    when(userDataStore.getLocalBucketById(eq(id + 113))).thenReturn(mockBucket);
+    when(fileDataStore.getLocalBucketById(eq(id))).thenReturn(fileBucket);
+    when(chunkDataStore.getLocalBucketById(eq(id))).thenReturn(chunkBucket);
     
     fileBuckets.put(id, fileBucket);
     chunkBuckets.put(id, chunkBucket);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/63ce3c0f/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
index 7d3caf8..cd67413 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
@@ -160,11 +160,18 @@ public class IndexRepositoryImplJUnitTest {
     repo.create("key1", new Type2("bar", 1, 2L, 3.0, 4.0f, "Grape Ape doughnut"));
     repo.commit();
     ArgumentCaptor<IntSupplier> captor = ArgumentCaptor.forClass(IntSupplier.class);
-    verify(stats).addDocumentsSuppplier(captor.capture());
+    verify(stats).addDocumentsSupplier(captor.capture());
     IntSupplier supplier = captor.getValue();
     assertEquals(1, supplier.getAsInt());
   }
 
+  @Test
+  public void cleanupShouldCloseWriter() throws IOException {
+    repo.cleanup();
+    verify(stats).removeDocumentsSupplier(any());
+    assertFalse(writer.isOpen());
+  }
+
   private void updateAndRemove(Object key1, Object key2, Object key3,
       Object key4) throws IOException, ParseException {
     repo.create(key1, new Type2("bacon maple bar", 1, 2L, 3.0, 4.0f, "Grape Ape doughnut"));


[13/26] incubator-geode git commit: Merge remote-tracking branch 'origin/feature/GEODE-1571' into feature/GEODE-1571

Posted by ji...@apache.org.
Merge remote-tracking branch 'origin/feature/GEODE-1571' into feature/GEODE-1571


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

Branch: refs/heads/feature/GEODE-1571
Commit: dbcdf33aa6043dd4deb37546d467714cecc2668d
Parents: ad9bec1 beb50ad
Author: Kevin J. Duling <kd...@pivotal.io>
Authored: Tue Jun 28 13:01:42 2016 -0700
Committer: Kevin J. Duling <kd...@pivotal.io>
Committed: Tue Jun 28 13:01:42 2016 -0700

----------------------------------------------------------------------
 .../security/templates/SamplePostProcessor.java |  2 +-
 .../security/GfshCommandsPostProcessorTest.java |  6 ++--
 ...tedClientContainsKeyAuthDistributedTest.java | 33 +++++---------------
 .../gemfire/security/SecurityTestUtils.java     | 14 ++-------
 4 files changed, 15 insertions(+), 40 deletions(-)
----------------------------------------------------------------------



[10/26] incubator-geode git commit: GEODE-1571: fix precheckin failures

Posted by ji...@apache.org.
GEODE-1571: fix precheckin failures


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

Branch: refs/heads/feature/GEODE-1571
Commit: beb50ad8e3a54761ccbeafb12f6dcda62629af16
Parents: 07d0817
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Tue Jun 28 11:55:02 2016 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Tue Jun 28 12:14:08 2016 -0700

----------------------------------------------------------------------
 ...tedClientContainsKeyAuthDistributedTest.java | 33 +++++---------------
 .../gemfire/security/SecurityTestUtils.java     | 14 ++-------
 2 files changed, 10 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/beb50ad8/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
index a02b49c..558c427 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/IntegratedClientContainsKeyAuthDistributedTest.java
@@ -18,51 +18,34 @@ package com.gemstone.gemfire.security;
 
 import static org.junit.Assert.*;
 
-import com.gemstone.gemfire.cache.Cache;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 @Category(DistributedTest.class)
 public class IntegratedClientContainsKeyAuthDistributedTest extends AbstractIntegratedClientAuthDistributedTest {
 
   @Test
   public void testContainsKey() throws InterruptedException {
-//    AsyncInvocation ai1 = client1.invokeAsync("containsKey with permission", () -> {
-//      ClientCache cache = new ClientCacheFactory(createClientProperties("dataReader", "1234567"))
-//          .setPoolSubscriptionEnabled(true)
-//          .addPoolServer("localhost", serverPort)
-//          .create();
-//
     AsyncInvocation ai1 = client1.invokeAsync(() -> {
-      Cache cache = SecurityTestUtils.createCacheClient("key1User", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION);
-      final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      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(() -> {
-      Cache cache = SecurityTestUtils.createCacheClient("authRegionReader", "1234567", serverPort, SecurityTestUtils.NO_EXCEPTION);
-      final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
+      ClientCache cache = createClientCache("authRegionReader", "1234567", serverPort);
+      final Region region = cache.getRegion(REGION_NAME);
       region.containsKeyOnServer("key3");
       assertTrue(region.containsKeyOnServer("key1"));
 
     });
 
-//    AsyncInvocation ai2 = client2.invokeAsync("containsKey without permission", () -> {
-//      ClientCache cache = new ClientCacheFactory(createClientProperties("authRegionReader", "1234567"))
-//        .setPoolSubscriptionEnabled(true)
-//        .addPoolServer("localhost", serverPort)
-//        .create();
-//
-//      Region region = cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(REGION_NAME);
-//      assertNotAuthorized(() -> region.containsKeyOnServer("key3"), "DATA:READ");
-
-//    });
-
     ai1.join();
     ai2.join();
     ai1.checkException();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/beb50ad8/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
index aeffe7f..5ff0344 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
@@ -43,6 +43,7 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.Callable;
+
 import javax.net.ServerSocketFactory;
 import javax.net.SocketFactory;
 import javax.net.ssl.KeyManager;
@@ -83,7 +84,6 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.pdx.PdxReader;
 import com.gemstone.gemfire.pdx.PdxSerializable;
 import com.gemstone.gemfire.pdx.PdxWriter;
-import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 
@@ -308,15 +308,6 @@ public final class SecurityTestUtils {
     return server1.getPort();
   }
 
-  protected static Cache createCacheClient(String userName, String password, int serverPort, int expectedResult){
-    Properties authProps = new Properties();
-    authProps.setProperty(UserPasswordAuthInit.USER_NAME, userName);
-    authProps.setProperty(UserPasswordAuthInit.PASSWORD, password);
-    int[] ports = new int[1];
-    ports[0] = serverPort;
-    return createCacheClient(UserPasswordAuthInit.class.getName()+".create", authProps, null, ports, 0, false, false, true, expectedResult);
-  }
-
   // 1
   protected static void createCacheClient(final String authInitModule,
                                           final Properties authProps,
@@ -366,7 +357,7 @@ public final class SecurityTestUtils {
   }
 
   // 5
-  protected static Cache createCacheClient(final String authInitModule,
+  protected static void createCacheClient(final String authInitModule,
                                           Properties authProps,
                                           final Properties javaProps,
                                           int[] ports,
@@ -480,7 +471,6 @@ public final class SecurityTestUtils {
     catch (Exception ex) {
       fail("Got unexpected exception when starting client", ex);
     }
-    return cache;
   }
 
   protected static void createCacheClientForMultiUserMode(final int numOfUsers,