geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [1/4] geode git commit: Fix issues
Date Thu, 01 Jun 2017 17:35:32 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2632-19 d5dc97c81 -> 7f1bd1e0a


http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAllTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAllTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAllTest.java
index 0677642..7d4a5a4 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAllTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAllTest.java
@@ -123,7 +123,7 @@ public class RemoveAllTest {
   public void noSecurityShouldSucceed() throws Exception {
     when(this.securityService.isClientSecurityRequired()).thenReturn(false);
 
-    this.removeAll.cmdExecute(, this.message, 0);
+    this.removeAll.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     verify(this.chunkedResponseMessage).sendChunk(eq(this.serverConnection));
   }
@@ -133,7 +133,7 @@ public class RemoveAllTest {
     when(this.securityService.isClientSecurityRequired()).thenReturn(true);
     when(this.securityService.isIntegratedSecurity()).thenReturn(true);
 
-    this.removeAll.cmdExecute(, this.message, 0);
+    this.removeAll.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     for (Object key : KEYS) {
       verify(this.securityService).authorizeRegionWrite(eq(REGION_NAME));
@@ -152,7 +152,7 @@ public class RemoveAllTest {
           .authorizeRegionRead(eq(REGION_NAME), eq(key.toString()));
     }
 
-    this.removeAll.cmdExecute(, this.message, 0);
+    this.removeAll.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     for (Object key : KEYS) {
       verify(this.securityService).authorizeRegionWrite(eq(REGION_NAME));
@@ -166,7 +166,7 @@ public class RemoveAllTest {
     when(this.securityService.isClientSecurityRequired()).thenReturn(true);
     when(this.securityService.isIntegratedSecurity()).thenReturn(false);
 
-    this.removeAll.cmdExecute(, this.message, 0);
+    this.removeAll.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     for (Object key : KEYS) {
       verify(this.authzRequest).removeAllAuthorize(eq(REGION_NAME), any(), any());
@@ -184,7 +184,7 @@ public class RemoveAllTest {
       doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME),
           eq(key.toString()), eq(null));
     }
-    this.removeAll.cmdExecute(, this.message, 0);
+    this.removeAll.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     for (Object key : KEYS) {
       verify(this.authzRequest).removeAllAuthorize(eq(REGION_NAME), any(), any());

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RequestTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RequestTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RequestTest.java
index fadf19e..271c078 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RequestTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/RequestTest.java
@@ -112,7 +112,7 @@ public class RequestTest {
   public void noSecurityShouldSucceed() throws Exception {
     when(this.securityService.isClientSecurityRequired()).thenReturn(false);
 
-    this.request.cmdExecute(, this.message, 0);
+    this.request.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
     verify(this.responseMessage).send(this.serverConnection);
   }
 
@@ -121,7 +121,7 @@ public class RequestTest {
     when(this.securityService.isClientSecurityRequired()).thenReturn(true);
     when(this.securityService.isIntegratedSecurity()).thenReturn(true);
 
-    this.request.cmdExecute(, this.message, 0);
+    this.request.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
 
     verify(this.securityService).authorizeRegionRead(eq(REGION_NAME), eq(KEY));
     verify(this.responseMessage).send(this.serverConnection);
@@ -134,7 +134,7 @@ public class RequestTest {
     doThrow(new NotAuthorizedException("")).when(this.securityService)
         .authorizeRegionRead(eq(REGION_NAME), eq(KEY));
 
-    this.request.cmdExecute(, this.message, 0);
+    this.request.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
 
     verify(this.securityService).authorizeRegionRead(eq(REGION_NAME), eq(KEY));
     verify(this.errorResponseMessage).send(eq(this.serverConnection));
@@ -145,7 +145,7 @@ public class RequestTest {
     when(this.securityService.isClientSecurityRequired()).thenReturn(true);
     when(this.securityService.isIntegratedSecurity()).thenReturn(false);
 
-    this.request.cmdExecute(, this.message, 0);
+    this.request.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
 
     verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG));
     verify(this.responseMessage).send(this.serverConnection);
@@ -158,7 +158,7 @@ public class RequestTest {
     doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME),
         eq(KEY), eq(CALLBACK_ARG));
 
-    this.request.cmdExecute(, this.message, 0);
+    this.request.cmdExecute(this.message, this.serverConnection, this.securityService, 0);
 
     verify(this.authzRequest).getAuthorize(eq(REGION_NAME), eq(KEY), eq(CALLBACK_ARG));
     verify(this.errorResponseMessage).send(eq(this.serverConnection));

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestTest.java
index 4044d37..8f366ee 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestTest.java
@@ -150,7 +150,7 @@ public class UnregisterInterestTest {
   public void noSecurityShouldSucceed() throws Exception {
     when(this.securityService.isClientSecurityRequired()).thenReturn(false);
 
-    this.unregisterInterest.cmdExecute(, this.message, 0);
+    this.unregisterInterest.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
     verify(this.replyMessage).send(this.serverConnection);
   }
 
@@ -159,7 +159,7 @@ public class UnregisterInterestTest {
     when(this.securityService.isClientSecurityRequired()).thenReturn(true);
     when(this.securityService.isIntegratedSecurity()).thenReturn(true);
 
-    this.unregisterInterest.cmdExecute(, this.message, 0);
+    this.unregisterInterest.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     verify(this.securityService).authorizeRegionRead(eq(REGION_NAME), eq(KEY));
     verify(this.replyMessage).send(this.serverConnection);
@@ -172,7 +172,7 @@ public class UnregisterInterestTest {
     doThrow(new NotAuthorizedException("")).when(this.securityService)
         .authorizeRegionRead(eq(REGION_NAME), eq(KEY));
 
-    this.unregisterInterest.cmdExecute(, this.message, 0);
+    this.unregisterInterest.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     verify(this.securityService).authorizeRegionRead(eq(REGION_NAME), eq(KEY));
     verify(this.errorResponseMessage).send(eq(this.serverConnection));
@@ -183,7 +183,7 @@ public class UnregisterInterestTest {
     when(this.securityService.isClientSecurityRequired()).thenReturn(true);
     when(this.securityService.isIntegratedSecurity()).thenReturn(false);
 
-    this.unregisterInterest.cmdExecute(, this.message, 0);
+    this.unregisterInterest.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     verify(this.authzRequest).unregisterInterestAuthorize(eq(REGION_NAME), eq(KEY), anyInt());
     verify(this.replyMessage).send(this.serverConnection);
@@ -196,7 +196,7 @@ public class UnregisterInterestTest {
     doThrow(new NotAuthorizedException("")).when(this.authzRequest).getAuthorize(eq(REGION_NAME),
         eq(KEY), any());
 
-    this.unregisterInterest.cmdExecute(, this.message, 0);
+    this.unregisterInterest.cmdExecute(this.message, this.serverConnection, this.securityService,
0);
 
     verify(this.authzRequest).unregisterInterestAuthorize(eq(REGION_NAME), eq(KEY), anyInt());
     verify(this.replyMessage).send(eq(this.serverConnection));

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
b/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
index 01782cf..bdd3d71 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/security/IntegratedSecurityServiceTest.java
@@ -46,7 +46,7 @@ public class IntegratedSecurityServiceTest {
   @Before
   public void before() {
     properties = new Properties();
-    securityService = SecurityService.getSecurityService();
+    securityService = SecurityServiceFactory.create(null, null);
     securityService.initSecurity(properties);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
index 8561f18..dabcde0 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/IntegratedSecurityServiceWithIniFileJUnitTest.java
@@ -19,6 +19,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.geode.internal.security.IntegratedSecurityService;
 import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.SecurityServiceFactory;
 import org.apache.geode.security.GemFireSecurityException;
 import org.apache.geode.security.ResourcePermission;
 import org.apache.geode.test.junit.categories.IntegrationTest;
@@ -38,7 +39,7 @@ public class IntegratedSecurityServiceWithIniFileJUnitTest {
 
   protected static Properties props = new Properties();
 
-  private SecurityService securityService = SecurityService.getSecurityService();
+  private SecurityService securityService;
 
   @BeforeClass
   public static void beforeClass() throws Exception {
@@ -47,7 +48,8 @@ public class IntegratedSecurityServiceWithIniFileJUnitTest {
 
   @Before
   public void before() {
-    securityService.initSecurity(props);
+    this.securityService = SecurityServiceFactory.create(null, null);
+    this.securityService.initSecurity(props);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/security/CacheFactoryWithSecurityObjectTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/CacheFactoryWithSecurityObjectTest.java
b/geode-core/src/test/java/org/apache/geode/security/CacheFactoryWithSecurityObjectTest.java
index 89030f5..8cabb1c 100644
--- a/geode-core/src/test/java/org/apache/geode/security/CacheFactoryWithSecurityObjectTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/CacheFactoryWithSecurityObjectTest.java
@@ -22,7 +22,9 @@ import static org.junit.Assert.assertTrue;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.SecurityServiceFactory;
 import org.apache.geode.security.templates.DummyAuthenticator;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
@@ -36,22 +38,21 @@ import java.util.Properties;
 @Category({IntegrationTest.class, SecurityTest.class})
 public class CacheFactoryWithSecurityObjectTest {
 
-  private SecurityService securityService;
   private SecurityManager simpleSecurityManager;
   private Properties properties = new Properties();
-  Cache cache;
+  private InternalCache cache;
 
   @Before
   public void before() throws Exception {
-    securityService = SecurityService.getSecurityService();
     simpleSecurityManager = new SimpleTestSecurityManager();
     properties.setProperty("mcast-port", "0");
   }
 
   @Test
   public void testCreateCacheWithSecurityManager() throws Exception {
-    cache = new CacheFactory(properties).setSecurityManager(simpleSecurityManager)
+    cache = (InternalCache) new CacheFactory(properties).setSecurityManager(simpleSecurityManager)
         .setPostProcessor(null).create();
+    SecurityService securityService = cache.getSecurityService();
     assertTrue(securityService.isIntegratedSecurity());
     assertFalse(securityService.needPostProcess());
     assertNotNull(securityService.getSecurityManager());
@@ -59,8 +60,9 @@ public class CacheFactoryWithSecurityObjectTest {
 
   @Test
   public void testCreateCacheWithPostProcessor() throws Exception {
-    cache = new CacheFactory(properties).setPostProcessor(new TestPostProcessor())
+    cache = (InternalCache) new CacheFactory(properties).setPostProcessor(new TestPostProcessor())
         .setSecurityManager(null).create();
+    SecurityService securityService = cache.getSecurityService();
     assertFalse(securityService.isIntegratedSecurity());
     assertFalse(securityService.needPostProcess());
     assertNotNull(securityService.getPostProcessor());
@@ -71,9 +73,11 @@ public class CacheFactoryWithSecurityObjectTest {
     properties.setProperty(ConfigurationProperties.SECURITY_CLIENT_AUTHENTICATOR,
         DummyAuthenticator.class.getName());
 
-    cache = new CacheFactory(properties).setSecurityManager(simpleSecurityManager)
+    cache = (InternalCache) new CacheFactory(properties).setSecurityManager(simpleSecurityManager)
         .setPostProcessor(new TestPostProcessor()).create();
 
+    SecurityService securityService = cache.getSecurityService();
+
     assertTrue(securityService.isIntegratedSecurity());
     assertTrue(securityService.isClientSecurityRequired());
     assertTrue(securityService.needPostProcess());

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
b/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
index c28f7aa..3beb4b6 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
@@ -102,7 +102,7 @@ public class PDXGfshPostProcessorOnRemoteServerTest {
 
     serverVM.invoke(() -> {
       PDXPostProcessor pp =
-          (PDXPostProcessor) SecurityService.getSecurityService().getPostProcessor();
+          (PDXPostProcessor) LocatorServerStartupRule.serverStarter.getCache().getSecurityService().getPostProcessor();
       // verify that the post processor is called 6 times. (5 for the query, 1 for the get)
       assertEquals(pp.getCount(), 6);
     });

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
index e952386..a806746 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
@@ -40,6 +40,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
@@ -114,7 +115,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase
{
 
     // this makes sure PostProcessor is getting called
     PDXPostProcessor pp =
-        (PDXPostProcessor) SecurityService.getSecurityService().getPostProcessor();
+        (PDXPostProcessor) server.getCache().getSecurityService().getPostProcessor();
     assertEquals(pp.getCount(), 2);
   }
 
@@ -149,7 +150,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase
{
 
     // this makes sure PostProcessor is getting called
     PDXPostProcessor pp =
-        (PDXPostProcessor) SecurityService.getSecurityService().getPostProcessor();
+        (PDXPostProcessor) server.getCache().getSecurityService().getPostProcessor();
     assertEquals(pp.getCount(), 2);
   }
 
@@ -190,7 +191,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase
{
     // wait for events to fire
     Awaitility.await().atMost(1, TimeUnit.SECONDS);
     PDXPostProcessor pp =
-        (PDXPostProcessor) SecurityService.getSecurityService().getPostProcessor();
+        (PDXPostProcessor) server.getCache().getSecurityService().getPostProcessor();
     assertEquals(pp.getCount(), 2);
   }
 
@@ -226,7 +227,7 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase
{
     });
 
     PDXPostProcessor pp =
-        (PDXPostProcessor) SecurityService.getSecurityService().getPostProcessor();
+        (PDXPostProcessor) LocatorServerStartupRule.serverStarter.getCache().getSecurityService().getPostProcessor();
     assertEquals(pp.getCount(), 4);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
index 30ae59f..5ccfbd0 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
@@ -19,7 +19,6 @@ import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_
 import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
 
-import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.server.CacheServer;
@@ -27,6 +26,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 
 import java.io.File;
 import java.io.IOException;
@@ -51,7 +51,7 @@ import java.util.Properties;
  * use {@link LocatorServerStartupRule}.
  */
 public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> implements
Server {
-  private transient Cache cache;
+  private transient InternalCache cache;
   private transient CacheServer server;
   private int embeddedLocatorPort = -1;
   private boolean pdxPersistent = false;
@@ -74,7 +74,7 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule>
impl
     super(workingDir);
   }
 
-  public Cache getCache() {
+  public InternalCache getCache() {
     return cache;
   }
 
@@ -150,7 +150,7 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule>
impl
     CacheFactory cf = new CacheFactory(this.properties);
     cf.setPdxReadSerialized(pdxPersistent);
     cf.setPdxPersistent(pdxPersistent);
-    cache = cf.create();
+    cache = (InternalCache) cf.create();
     DistributionConfig config =
         ((InternalDistributedSystem) cache.getDistributedSystem()).getConfig();
     server = cache.addCacheServer();

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
index 5a6c3c4..43fa44c 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
@@ -33,7 +33,6 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.security.AuthorizeRequest;
 import org.apache.geode.internal.security.SecurityService;
 
-
 public class CloseCQ extends BaseCQCommand {
 
   private final static CloseCQ singleton = new CloseCQ();
@@ -70,11 +69,11 @@ public class CloseCQ extends BaseCQCommand {
       String err =
           LocalizedStrings.CloseCQ_THE_CQNAME_FOR_THE_CQ_CLOSE_REQUEST_IS_NULL.toLocalizedString();
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
null,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
 
-    this.securityService.authorizeDataManage();
+    securityService.authorizeDataManage();
 
     // Process CQ close request
     try {
@@ -108,20 +107,20 @@ public class CloseCQ extends BaseCQCommand {
         serverConnection.removeCq(cqName, cqQuery.isDurable());
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(),
cqe,
-          serverConnection);
+          serverConnection, securityService);
       return;
     } catch (Exception e) {
       String err =
           LocalizedStrings.CloseCQ_EXCEPTION_WHILE_CLOSING_CQ_CQNAME_0.toLocalizedString(cqName);
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(),
e,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
 
     // Send OK to client
     sendCqResponse(MessageType.REPLY,
         LocalizedStrings.CloseCQ_CQ_CLOSED_SUCCESSFULLY.toLocalizedString(),
-        clientMessage.getTransactionId(), null, serverConnection);
+        clientMessage.getTransactionId(), null, serverConnection, securityService);
     serverConnection.setAsTrue(RESPONDED);
 
     {

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
index 026134f..2e0299e 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
@@ -110,7 +110,7 @@ public class ExecuteCQ extends BaseCQCommand {
           acceptor.getCacheClientNotifier(), isDurable, false, 0, null);
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(),
cqe,
-          serverConnection);
+          serverConnection, securityService);
       return;
     } catch (Exception e) {
       writeChunkedException(clientMessage, e, serverConnection);
@@ -133,7 +133,7 @@ public class ExecuteCQ extends BaseCQCommand {
       }
       ((DefaultQuery) query).setIsCqQuery(true);
       successQuery = processQuery(clientMessage, query, cqQueryString, cqRegionNames, start,
-          cqQuery, executeCQContext, serverConnection, sendResults);
+          cqQuery, executeCQContext, serverConnection, sendResults, securityService);
 
       // Update the CQ statistics.
       cqQuery.getVsdStats().setCqInitialResultsTime((DistributionStats.getStatTime()) - oldstart);
@@ -155,7 +155,7 @@ public class ExecuteCQ extends BaseCQCommand {
       // Send OK to client
       sendCqResponse(MessageType.REPLY,
           LocalizedStrings.ExecuteCQ_CQ_CREATED_SUCCESSFULLY.toLocalizedString(),
-          clientMessage.getTransactionId(), null, serverConnection);
+          clientMessage.getTransactionId(), null, serverConnection, securityService);
 
       long start2 = DistributionStats.getStatTime();
       stats.incProcessCreateCqTime(start2 - oldstart);

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
index f15046a..b9c85db 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
@@ -98,7 +98,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
             LocalizedStrings.ExecuteCQ_SERVER_NOTIFYBYSUBSCRIPTION_MODE_IS_SET_TO_FALSE_CQ_EXECUTION_IS_NOT_SUPPORTED_IN_THIS_MODE
                 .toLocalizedString();
         sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
-            null, serverConnection);
+            null, serverConnection, securityService);
         return;
       }
     }
@@ -147,7 +147,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
           isDurable, true, regionDataPolicyPartBytes[0], null);
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(),
cqe,
-          serverConnection);
+          serverConnection, securityService);
       serverConnection.removeCq(cqName, isDurable);
       return;
     } catch (Exception e) {
@@ -176,7 +176,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
         }
         ((DefaultQuery) query).setIsCqQuery(true);
         successQuery = processQuery(clientMessage, query, cqQueryString, cqRegionNames, start,
-            cqQuery, executeCQContext, serverConnection, sendResults);
+            cqQuery, executeCQContext, serverConnection, sendResults, securityService);
 
 
         // Update the CQ statistics.
@@ -205,13 +205,12 @@ public class ExecuteCQ61 extends BaseCQCommand {
       // Send OK to client
       sendCqResponse(MessageType.REPLY,
           LocalizedStrings.ExecuteCQ_CQ_CREATED_SUCCESSFULLY.toLocalizedString(),
-          clientMessage.getTransactionId(), null, serverConnection);
+          clientMessage.getTransactionId(), null, serverConnection, securityService);
 
       long start2 = DistributionStats.getStatTime();
       stats.incProcessCreateCqTime(start2 - oldstart);
     }
     serverConnection.setAsTrue(RESPONDED);
-
   }
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
index 42b5602..47a26f5 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
@@ -64,11 +64,11 @@ public class GetCQStats extends BaseCQCommand {
     if (cqName == null) {
       String err = "The cqName for the cq stats request is null";
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
null,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
 
-    this.securityService.authorizeClusterRead();
+    securityService.authorizeClusterRead();
     // Process the cq request
     try {
       // make sure the cqservice has been created
@@ -78,12 +78,12 @@ public class GetCQStats extends BaseCQCommand {
     } catch (Exception e) {
       String err = "Exception while Getting the CQ Statistics. ";
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(),
e,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
     // Send OK to client
     sendCqResponse(MessageType.REPLY, "cq stats sent successfully.",
-        clientMessage.getTransactionId(), null, serverConnection);
+        clientMessage.getTransactionId(), null, serverConnection, securityService);
     serverConnection.setAsTrue(RESPONDED);
 
     {

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
index c44d7d2..dfe77e0 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
@@ -67,7 +67,7 @@ public class GetDurableCQs extends BaseCQCommand {
     try {
       qService = (DefaultQueryService) crHelper.getCache().getLocalQueryService();
 
-      this.securityService.authorizeClusterRead();
+      securityService.authorizeClusterRead();
 
       // Authorization check
       AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
@@ -103,7 +103,7 @@ public class GetDurableCQs extends BaseCQCommand {
 
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(),
cqe,
-          serverConnection);
+          serverConnection, securityService);
       return;
     } catch (Exception e) {
       writeChunkedException(clientMessage, e, serverConnection);

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
index 7c003e5..678c984 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
@@ -50,7 +50,7 @@ public class MonitorCQ extends BaseCQCommand {
       String err = LocalizedStrings.MonitorCQ__0_THE_MONITORCQ_OPERATION_IS_INVALID
           .toLocalizedString(serverConnection.getName());
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
null,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
 
@@ -64,7 +64,7 @@ public class MonitorCQ extends BaseCQCommand {
             LocalizedStrings.MonitorCQ__0_A_NULL_REGION_NAME_WAS_PASSED_FOR_MONITORCQ_OPERATION
                 .toLocalizedString(serverConnection.getName());
         sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
-            null, serverConnection);
+            null, serverConnection, securityService);
         return;
       }
     }
@@ -75,7 +75,7 @@ public class MonitorCQ extends BaseCQCommand {
           (regionName != null) ? " RegionName: " + regionName : "");
     }
 
-    this.securityService.authorizeClusterRead();
+    securityService.authorizeClusterRead();
 
     try {
       CqService cqService = crHelper.getCache().getCqService();
@@ -90,13 +90,13 @@ public class MonitorCQ extends BaseCQCommand {
           LocalizedStrings.CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED.toLocalizedString());
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(),
cqe,
-          serverConnection);
+          serverConnection, securityService);
       return;
     } catch (Exception e) {
       String err = LocalizedStrings.MonitorCQ_EXCEPTION_WHILE_HANDLING_THE_MONITOR_REQUEST_OP_IS_0
           .toLocalizedString(Integer.valueOf(op));
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(),
e,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
index ba5a962..fdb4e6b 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
@@ -70,7 +70,7 @@ public class StopCQ extends BaseCQCommand {
       String err =
           LocalizedStrings.StopCQ_THE_CQNAME_FOR_THE_CQ_STOP_REQUEST_IS_NULL.toLocalizedString();
       sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(),
null,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
 
@@ -87,7 +87,7 @@ public class StopCQ extends BaseCQCommand {
       }
       InternalCqQuery cqQuery = cqService.getCq(serverCqName);
 
-      this.securityService.authorizeDataManage();
+      securityService.authorizeDataManage();
 
       AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
       if (authzRequest != null) {
@@ -106,20 +106,20 @@ public class StopCQ extends BaseCQCommand {
         serverConnection.removeCq(cqName, cqQuery.isDurable());
     } catch (CqException cqe) {
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(),
cqe,
-          serverConnection);
+          serverConnection, securityService);
       return;
     } catch (Exception e) {
       String err =
           LocalizedStrings.StopCQ_EXCEPTION_WHILE_STOPPING_CQ_NAMED_0.toLocalizedString(cqName);
       sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(),
e,
-          serverConnection);
+          serverConnection, securityService);
       return;
     }
 
     // Send OK to client
     sendCqResponse(MessageType.REPLY,
         LocalizedStrings.StopCQ_CQ_STOPPED_SUCCESSFULLY.toLocalizedString(),
-        clientMessage.getTransactionId(), null, serverConnection);
+        clientMessage.getTransactionId(), null, serverConnection, securityService);
 
     serverConnection.setAsTrue(RESPONDED);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
b/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
index 2489b95..c38bd3b 100644
--- a/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/security/CQPDXPostProcessorDUnitTest.java
@@ -128,7 +128,7 @@ public class CQPDXPostProcessorDUnitTest extends JUnit4DistributedTestCase
{
     // wait for events to fire
     Awaitility.await().atMost(1, TimeUnit.SECONDS);
     PDXPostProcessor pp =
-        (PDXPostProcessor) SecurityService.getSecurityService().getPostProcessor();
+        (PDXPostProcessor) server.getCache().getSecurityService().getPostProcessor();
     assertEquals(pp.getCount(), 2);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/Server.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/Server.java b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/Server.java
index 856cc09..a82b8e7 100644
--- a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/Server.java
+++ b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/Server.java
@@ -1,5 +1,4 @@
 /*
- *
  * 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
@@ -12,7 +11,6 @@
  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express
  * or implied. See the License for the specific language governing permissions and limitations
under
  * the License.
- *
  */
 package org.apache.geode.tools.pulse.tests;
 
@@ -37,6 +35,7 @@ import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
 
 import org.apache.geode.internal.security.DisabledSecurityService;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.tools.pulse.internal.data.PulseConstants;
 import org.apache.geode.security.TestSecurityManager;
 import org.apache.shiro.SecurityUtils;
@@ -59,7 +58,8 @@ public class Server {
   private JMXConnectorServer cs;
   private String propFile = null;
 
-  public Server(int jmxPort, String properties, String jsonAuthFile) throws Exception {
+  public Server(int jmxPort, String properties, String jsonAuthFile,
+                final SecurityService securityService) throws Exception {
     this.propFile = properties;
     mbs = ManagementFactory.getPlatformMBeanServer();
     url = new JMXServiceURL(formJMXServiceURLString(DEFAULT_HOST, jmxPort));
@@ -86,10 +86,10 @@ public class Server {
       platformMBeanServer.registerMBean(acc, accessControlMBeanON);
 
       // wire in the authenticator and authorizaton
-      JMXShiroAuthenticator interceptor = new JMXShiroAuthenticator();
+      JMXShiroAuthenticator interceptor = new JMXShiroAuthenticator(securityService);
       env.put(JMXConnectorServer.AUTHENTICATOR, interceptor);
       cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
-      cs.setMBeanServerForwarder(new MBeanServerWrapper());
+      cs.setMBeanServerForwarder(new MBeanServerWrapper(securityService));
 
       // set up the AccessControlMXBean
 
@@ -225,10 +225,11 @@ public class Server {
     return propVal.split(" ");
   }
 
-  public static Server createServer(int jmxPort, String properties, String jsonAuthFile)
{
+  public static Server createServer(int jmxPort, String properties, String jsonAuthFile,
+                                    final SecurityService securityService) {
     Server s = null;
     try {
-      s = new Server(jmxPort, properties, jsonAuthFile);
+      s = new Server(jmxPort, properties, jsonAuthFile, securityService);
     } catch (Exception e) {
       e.printStackTrace();
       return null;

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/rules/ServerRule.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/rules/ServerRule.java
b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/rules/ServerRule.java
index 3183f87..24c812b 100644
--- a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/rules/ServerRule.java
+++ b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/tests/rules/ServerRule.java
@@ -11,12 +11,10 @@
  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express
  * or implied. See the License for the specific language governing permissions and limitations
under
  * the License.
- *
  */
-
 package org.apache.geode.tools.pulse.tests.rules;
 
-
+import org.apache.geode.internal.security.DisabledSecurityService;
 import org.apache.geode.tools.pulse.internal.data.PulseConstants;
 import org.awaitility.Awaitility;
 import org.apache.geode.internal.AvailablePort;
@@ -43,7 +41,7 @@ public class ServerRule extends ExternalResource {
     String jmxPropertiesFile = classLoader.getResource("test.properties").getPath();
 
     int jmxPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-    server = Server.createServer(jmxPort, jmxPropertiesFile, jsonAuthFile);
+    server = Server.createServer(jmxPort, jmxPropertiesFile, jsonAuthFile, new DisabledSecurityService());
     System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_HOST, LOCALHOST);
     System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_PORT, Integer.toString(jmxPort));
 

http://git-wip-us.apache.org/repos/asf/geode/blob/7f1bd1e0/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/security/RestSecurityService.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/security/RestSecurityService.java
b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/security/RestSecurityService.java
index 80ff719..dd25379 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/security/RestSecurityService.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/security/RestSecurityService.java
@@ -12,16 +12,28 @@
  * or implied. See the License for the specific language governing permissions and limitations
under
  * the License.
  */
-
 package org.apache.geode.rest.internal.web.security;
 
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.security.DisabledSecurityService;
 import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.security.GemFireSecurityException;
 import org.springframework.stereotype.Component;
 
 @Component("securityService")
 public class RestSecurityService {
-  private SecurityService securityService = SecurityService.getSecurityService();
+
+  private final SecurityService securityService;
+
+  public RestSecurityService() {
+    InternalCache cache = GemFireCacheImpl.getInstance();
+    if (cache != null) {
+      this.securityService = cache.getSecurityService();
+    } else {
+      this.securityService = new DisabledSecurityService();
+    }
+  }
 
   public boolean authorize(String resource, String operation) {
     return authorize(resource, operation, null, null);


Mime
View raw message