geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject geode git commit: Fixup
Date Mon, 05 Jun 2017 00:49:17 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2632-20 [created] f051e803e


Fixup


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

Branch: refs/heads/feature/GEODE-2632-20
Commit: f051e803ee90ded225331456d81af8f6f054969f
Parents: b8d211f
Author: Kirk Lund <klund@apache.org>
Authored: Sun Jun 4 17:48:53 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Sun Jun 4 17:48:53 2017 -0700

----------------------------------------------------------------------
 .../org/apache/geode/cache/CacheFactory.java    |  12 +-
 .../geode/cache/client/ClientCacheFactory.java  |   4 +-
 .../internal/DistributionManager.java           |   4 +-
 .../internal/InternalDistributedSystem.java     |  43 ++++---
 .../internal/membership/MemberFactory.java      |  16 +--
 .../internal/membership/MemberServices.java     |   4 +-
 .../membership/gms/GMSMemberFactory.java        |  11 +-
 .../internal/membership/gms/Services.java       | 118 ++++++++++---------
 .../geode/internal/cache/GemFireCacheImpl.java  |  18 ++-
 .../security/EnabledSecurityService.java        |   4 +-
 .../security/SecurityServiceFactory.java        |  31 +++--
 .../functions/RecreateCacheFunction.java        |   4 +-
 .../AnalyzeSerializablesJUnitTest.java          |  23 ++--
 .../membership/MembershipJUnitTest.java         |  80 +++++++------
 .../locator/GMSLocatorRecoveryJUnitTest.java    |  70 +++++++----
 .../security/SecurityServiceFactoryTest.java    |  28 ++---
 .../apache/geode/tools/pulse/tests/Server.java  |   2 +-
 17 files changed, 262 insertions(+), 210 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java b/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
index 36560fd..d9faf6b 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
@@ -14,8 +14,6 @@
  */
 package org.apache.geode.cache;
 
-import java.util.Properties;
-
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
@@ -32,6 +30,8 @@ import org.apache.geode.security.AuthenticationRequiredException;
 import org.apache.geode.security.PostProcessor;
 import org.apache.geode.security.SecurityManager;
 
+import java.util.Properties;
+
 /**
  * Factory class used to create the singleton {@link Cache cache} and connect to the GemFire
  * singleton {@link DistributedSystem distributed system}. If the application wants to connect to
@@ -170,7 +170,7 @@ public class CacheFactory {
       CacheConfig cacheConfig) throws CacheExistsException, TimeoutException, CacheWriterException,
       GatewayException, RegionExistsException {
     // Moved code in this method to GemFireCacheImpl.create
-    return GemFireCacheImpl.create(system, existingOk, cacheConfig);
+    return GemFireCacheImpl.create((InternalDistributedSystem) system, existingOk, cacheConfig);
   }
 
   /**
@@ -201,17 +201,17 @@ public class CacheFactory {
   public Cache create()
       throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
     synchronized (CacheFactory.class) {
-      // TODO:KIRK: need SecurityService for both DistributedSystem and create below
       DistributedSystem ds = null;
       if (this.dsProps.isEmpty()) {
         // any ds will do
         ds = InternalDistributedSystem.getConnectedInstance();
-        // TODO:KIRK: if already connected AND we specify security then throw Error
+        // TODO:if already connected AND used setSecurityManager or setPostProcessor then throw
+        // Error
       }
       if (ds == null) {
         ds = DistributedSystem.connect(this.dsProps);
       }
-      return create(ds, true, cacheConfig);
+      return create(ds, true, this.cacheConfig);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java b/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
index 0d678ca..4839a7c 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
@@ -27,6 +27,7 @@ import org.apache.geode.cache.TimeoutException;
 import org.apache.geode.cache.client.internal.InternalClientCache;
 import org.apache.geode.cache.server.CacheServer;
 import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.cache.CacheConfig;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
@@ -237,7 +238,8 @@ public class ClientCacheFactory {
       }
       this.dsProps.setProperty(MCAST_PORT, "0");
       this.dsProps.setProperty(LOCATORS, "");
-      DistributedSystem system = DistributedSystem.connect(this.dsProps);
+      InternalDistributedSystem system =
+          (InternalDistributedSystem) DistributedSystem.connect(this.dsProps);
 
       if (instance != null && !instance.isClosed()) {
         // this is ok; just make sure it is a client cache

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
index 029e637..11d87a7 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
@@ -1149,8 +1149,8 @@ public class DistributionManager implements DM {
       start = System.currentTimeMillis();
 
       MyListener l = new MyListener(this);
-      membershipManager =
-          MemberFactory.newMembershipManager(l, system.getConfig(), transport, stats);
+      membershipManager = MemberFactory.newMembershipManager(l, system.getConfig(), transport,
+          stats, system.getSecurityService());
 
       sb.append(System.currentTimeMillis() - start);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
index 7caad3f..bcabe3d 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
@@ -40,6 +40,9 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.geode.cache.CacheXmlException;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.SecurityServiceFactory;
+import org.apache.geode.security.PostProcessor;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.CancelCriterion;
@@ -108,6 +111,7 @@ import org.apache.geode.internal.statistics.platform.OsStatisticsFactory;
 import org.apache.geode.internal.tcp.ConnectionTable;
 import org.apache.geode.management.ManagementException;
 import org.apache.geode.security.GemFireSecurityException;
+import org.apache.geode.security.SecurityManager;
 
 /**
  * The concrete implementation of {@link DistributedSystem} that provides internal-only
@@ -291,35 +295,41 @@ public class InternalDistributedSystem extends DistributedSystem
    */
   private final Throwable creationStack;
 
+  private volatile SecurityService securityService;
+
   ///////////////////// Static Methods /////////////////////
 
   /**
    * Creates a new instance of <code>InternalDistributedSystem</code> with the given configuration.
    */
   public static InternalDistributedSystem newInstance(Properties config) {
+    return newInstance(config, null, null);
+  }
+
+  public static InternalDistributedSystem newInstance(Properties config,
+      SecurityManager securityManager, PostProcessor postProcessor) {
     boolean success = false;
     InternalDataSerializer.checkSerializationVersion();
     try {
       SystemFailure.startThreads();
       InternalDistributedSystem newSystem = new InternalDistributedSystem(config);
-      newSystem.initialize();
+      newSystem.initialize(securityManager, postProcessor);
       reconnectAttemptCounter = 0; // reset reconnect count since we just got a new connection
       notifyConnectListeners(newSystem);
       success = true;
       return newSystem;
     } finally {
       if (!success) {
-        LoggingThreadGroup.cleanUpThreadGroups(); // bug44365 - logwriters accumulate, causing mem
-                                                  // leak
+        // bug44365 - logwriters accumulate, causing mem leak
+        LoggingThreadGroup.cleanUpThreadGroups();
         SystemFailure.stopThreads();
       }
     }
   }
 
-
   /**
    * creates a non-functional instance for testing
-   * 
+   *
    * @param nonDefault - non-default distributed system properties
    */
   public static InternalDistributedSystem newInstanceForTesting(DM dm, Properties nonDefault) {
@@ -488,23 +498,14 @@ public class InternalDistributedSystem extends DistributedSystem
 
     this.creationStack =
         TEST_CREATION_STACK_GENERATOR.get().generateCreationStack(this.originalConfig);
-
-    // if (DistributionConfigImpl.multicastTest) {
-    // this.logger.warning("Use of multicast has been forced");
-    // }
-    // if (DistributionConfigImpl.forceDisableTcp) {
-    // this.logger.warning("Use of UDP has been forced");
-    // }
-    // if
-    // (org.apache.geode.distributed.internal.membership.jgroup.JGroupMembershipManager.multicastTest)
-    // {
-    // this.logger.warning("Use of multicast for all distributed cache operations has been forced");
-    // }
-
   }
 
   //////////////////// Instance Methods ////////////////////
 
+  public SecurityService getSecurityService() {
+    return this.securityService;
+  }
+
   /**
    * Registers a listener to the system
    * 
@@ -562,7 +563,7 @@ public class InternalDistributedSystem extends DistributedSystem
   /**
    * Initializes this connection to a distributed system with the current configuration state.
    */
-  private void initialize() {
+  private void initialize(SecurityManager securityManager, PostProcessor postProcessor) {
     if (this.originalConfig.getLocators().equals("")) {
       if (this.originalConfig.getMcastPort() != 0) {
         throw new GemFireConfigException("The " + LOCATORS + " attribute can not be empty when the "
@@ -574,6 +575,10 @@ public class InternalDistributedSystem extends DistributedSystem
     }
 
     this.config = new RuntimeDistributionConfigImpl(this);
+
+    this.securityService =
+        SecurityServiceFactory.create(this.config, securityManager, postProcessor);
+
     if (!this.isLoner) {
       this.attemptingToReconnect = (reconnectAttemptCounter > 0);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberFactory.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberFactory.java
index f324e33..b682d93 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberFactory.java
@@ -20,6 +20,7 @@ import org.apache.geode.distributed.internal.LocatorStats;
 import org.apache.geode.distributed.internal.membership.gms.GMSMemberFactory;
 import org.apache.geode.distributed.internal.membership.gms.NetLocator;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
+import org.apache.geode.internal.security.SecurityService;
 
 import java.io.File;
 import java.net.InetAddress;
@@ -45,7 +46,7 @@ public class MemberFactory {
    * @param payload the payload for this member
    * @return the new NetMember
    */
-  static public NetMember newNetMember(InetAddress i, int p, boolean splitBrainEnabled,
+  public static NetMember newNetMember(InetAddress i, int p, boolean splitBrainEnabled,
       boolean canBeCoordinator, short version, MemberAttributes payload) {
     return services.newNetMember(i, p, splitBrainEnabled, canBeCoordinator, payload, version);
   }
@@ -57,7 +58,7 @@ public class MemberFactory {
    * @param p the membership port being used
    * @return the new NetMember
    */
-  static public NetMember newNetMember(InetAddress i, int p) {
+  public static NetMember newNetMember(InetAddress i, int p) {
     NetMember result = services.newNetMember(i, p);
     return result;
   }
@@ -69,7 +70,7 @@ public class MemberFactory {
    * @param p the membership port being used
    * @return the new member
    */
-  static public NetMember newNetMember(String s, int p) {
+  public static NetMember newNetMember(String s, int p) {
     return services.newNetMember(s, p);
   }
 
@@ -84,16 +85,17 @@ public class MemberFactory {
    * @param stats are used for recording statistical communications information
    * @return a MembershipManager
    */
-  static public MembershipManager newMembershipManager(DistributedMembershipListener listener,
-      DistributionConfig config, RemoteTransportConfig transport, DMStats stats) {
-    return services.newMembershipManager(listener, config, transport, stats);
+  public static MembershipManager newMembershipManager(DistributedMembershipListener listener,
+      DistributionConfig config, RemoteTransportConfig transport, DMStats stats,
+      SecurityService securityService) {
+    return services.newMembershipManager(listener, config, transport, stats, securityService);
   }
 
   /**
    * currently this is a test method but it ought to be used by InternalLocator to create the peer
    * location TcpHandler
    */
-  static public NetLocator newLocatorHandler(InetAddress bindAddress, File stateFile,
+  public static NetLocator newLocatorHandler(InetAddress bindAddress, File stateFile,
       String locatorString, boolean usePreferredCoordinators,
       boolean networkPartitionDetectionEnabled, LocatorStats stats, String securityUDPDHAlgo) {
     return services.newLocatorHandler(bindAddress, stateFile, locatorString,

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberServices.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberServices.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberServices.java
index 6024966..c52ccbc 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberServices.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/MemberServices.java
@@ -19,6 +19,7 @@ import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.LocatorStats;
 import org.apache.geode.distributed.internal.membership.gms.NetLocator;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
+import org.apache.geode.internal.security.SecurityService;
 
 import java.io.File;
 import java.net.InetAddress;
@@ -75,7 +76,8 @@ public interface MemberServices {
    * @return a MembershipManager
    */
   public abstract MembershipManager newMembershipManager(DistributedMembershipListener listener,
-      DistributionConfig config, RemoteTransportConfig transport, DMStats stats);
+      DistributionConfig config, RemoteTransportConfig transport, DMStats stats,
+      SecurityService securityService);
 
 
   /**

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMemberFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMemberFactory.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMemberFactory.java
index bc94ab5..01d9995 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMemberFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMemberFactory.java
@@ -34,6 +34,7 @@ import org.apache.geode.internal.Version;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.security.SecurityService;
 import org.apache.geode.internal.tcp.ConnectionException;
 import org.apache.geode.security.GemFireSecurityException;
 
@@ -55,6 +56,7 @@ public class GMSMemberFactory implements MemberServices {
    * @param attr the MemberAttributes
    * @return the new NetMember
    */
+  @Override
   public NetMember newNetMember(InetAddress i, int p, boolean splitBrainEnabled,
       boolean canBeCoordinator, MemberAttributes attr, short version) {
     GMSMember result =
@@ -70,6 +72,7 @@ public class GMSMemberFactory implements MemberServices {
    * @param p the membership port being used
    * @return the new NetMember
    */
+  @Override
   public NetMember newNetMember(InetAddress i, int p) {
     return new GMSMember(MemberAttributes.DEFAULT, i, p, false, true, Version.CURRENT_ORDINAL, 0,
         0);
@@ -83,6 +86,7 @@ public class GMSMemberFactory implements MemberServices {
    * @param p the membership port being used
    * @return the new member
    */
+  @Override
   public NetMember newNetMember(String s, int p) {
     InetAddress inetAddr = null;
     try {
@@ -93,10 +97,11 @@ public class GMSMemberFactory implements MemberServices {
     return newNetMember(inetAddr, p);
   }
 
+  @Override
   public MembershipManager newMembershipManager(DistributedMembershipListener listener,
-      DistributionConfig config, RemoteTransportConfig transport, DMStats stats)
-      throws DistributionException {
-    Services services = new Services(listener, config, transport, stats);
+      DistributionConfig config, RemoteTransportConfig transport, DMStats stats,
+      SecurityService securityService) throws DistributionException {
+    Services services = new Services(listener, config, transport, stats, securityService);
     try {
       services.init();
       services.start();

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/Services.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/Services.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/Services.java
index bae5a88..2d6af1a 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/Services.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/Services.java
@@ -26,7 +26,12 @@ import org.apache.geode.distributed.internal.membership.MembershipManager;
 import org.apache.geode.distributed.internal.membership.NetView;
 import org.apache.geode.distributed.internal.membership.gms.auth.GMSAuthenticator;
 import org.apache.geode.distributed.internal.membership.gms.fd.GMSHealthMonitor;
-import org.apache.geode.distributed.internal.membership.gms.interfaces.*;
+import org.apache.geode.distributed.internal.membership.gms.interfaces.Authenticator;
+import org.apache.geode.distributed.internal.membership.gms.interfaces.HealthMonitor;
+import org.apache.geode.distributed.internal.membership.gms.interfaces.JoinLeave;
+import org.apache.geode.distributed.internal.membership.gms.interfaces.Locator;
+import org.apache.geode.distributed.internal.membership.gms.interfaces.Manager;
+import org.apache.geode.distributed.internal.membership.gms.interfaces.Messenger;
 import org.apache.geode.distributed.internal.membership.gms.locator.GMSLocator;
 import org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave;
 import org.apache.geode.distributed.internal.membership.gms.messenger.JGroupsMessenger;
@@ -53,14 +58,14 @@ public class Services {
   private static InternalLogWriter staticLogWriter;
   private static InternalLogWriter staticSecurityLogWriter;
 
-  final private Manager manager;
-  final private JoinLeave joinLeave;
-  final private HealthMonitor healthMon;
-  final private Messenger messenger;
-  final private Authenticator auth;
-  final private ServiceConfig config;
-  final private DMStats stats;
-  final private Stopper cancelCriterion;
+  private final Manager manager;
+  private final JoinLeave joinLeave;
+  private final HealthMonitor healthMon;
+  private final Messenger messenger;
+  private final Authenticator auth;
+  private final ServiceConfig config;
+  private final DMStats stats;
+  private final Stopper cancelCriterion;
   private final SecurityService securityService;
 
   private volatile boolean stopping;
@@ -74,8 +79,6 @@ public class Services {
 
   private final Timer timer = new Timer("Geode Membership Timer", true);
 
-
-
   /**
    * A common logger for membership classes
    */
@@ -101,7 +104,6 @@ public class Services {
     return this.stopped;
   }
 
-
   /**
    * for testing only - create a non-functional Services object with a Stopper
    */
@@ -113,12 +115,12 @@ public class Services {
     this.joinLeave = null;
     this.healthMon = null;
     this.messenger = null;
-    this.securityService = null;
+    this.securityService = SecurityServiceFactory.create();
     this.auth = null;
   }
 
   public Services(DistributedMembershipListener listener, DistributionConfig config,
-      RemoteTransportConfig transport, DMStats stats) {
+      RemoteTransportConfig transport, DMStats stats, SecurityService securityService) {
     this.cancelCriterion = new Stopper();
     this.stats = stats;
     this.config = new ServiceConfig(transport, config);
@@ -126,16 +128,16 @@ public class Services {
     this.joinLeave = new GMSJoinLeave();
     this.healthMon = new GMSHealthMonitor();
     this.messenger = new JGroupsMessenger();
-    this.securityService = SecurityServiceFactory.create(null, config);
+    this.securityService = securityService;
     this.auth = new GMSAuthenticator();
   }
 
   protected void init() {
     // InternalDistributedSystem establishes this log writer at boot time
     // TODO fix this so that IDS doesn't know about Services
-    securityLogWriter = staticSecurityLogWriter;
+    this.securityLogWriter = staticSecurityLogWriter;
     staticSecurityLogWriter = null;
-    logWriter = staticLogWriter;
+    this.logWriter = staticLogWriter;
     staticLogWriter = null;
     this.auth.init(this);
     this.messenger.init(this);
@@ -193,29 +195,29 @@ public class Services {
   }
 
   public void emergencyClose() {
-    if (stopping) {
+    if (this.stopping) {
       return;
     }
-    stopping = true;
+    this.stopping = true;
     logger.info("Stopping membership services");
-    timer.cancel();
+    this.timer.cancel();
     try {
-      joinLeave.emergencyClose();
+      this.joinLeave.emergencyClose();
     } finally {
       try {
-        healthMon.emergencyClose();
+        this.healthMon.emergencyClose();
       } finally {
         try {
-          auth.emergencyClose();
+          this.auth.emergencyClose();
         } finally {
           try {
-            messenger.emergencyClose();
+            this.messenger.emergencyClose();
           } finally {
             try {
-              manager.emergencyClose();
+              this.manager.emergencyClose();
             } finally {
-              cancelCriterion.cancel("Membership services are shut down");
-              stopped = true;
+              this.cancelCriterion.cancel("Membership services are shut down");
+              this.stopped = true;
             }
           }
         }
@@ -224,31 +226,31 @@ public class Services {
   }
 
   public void stop() {
-    if (stopping) {
+    if (this.stopping) {
       return;
     }
     logger.info("Stopping membership services");
-    stopping = true;
+    this.stopping = true;
     try {
-      timer.cancel();
+      this.timer.cancel();
     } finally {
       try {
-        joinLeave.stop();
+        this.joinLeave.stop();
       } finally {
         try {
-          healthMon.stop();
+          this.healthMon.stop();
         } finally {
           try {
-            auth.stop();
+            this.auth.stop();
           } finally {
             try {
-              messenger.stop();
+              this.messenger.stop();
             } finally {
               try {
-                manager.stop();
+                this.manager.stop();
               } finally {
-                cancelCriterion.cancel("Membership services are shut down");
-                stopped = true;
+                this.cancelCriterion.cancel("Membership services are shut down");
+                this.stopped = true;
               }
             }
           }
@@ -278,38 +280,38 @@ public class Services {
   }
 
   public Authenticator getAuthenticator() {
-    return auth;
+    return this.auth;
   }
 
   public void installView(NetView v) {
     try {
-      auth.installView(v);
+      this.auth.installView(v);
     } catch (AuthenticationFailedException e) {
       return;
     }
-    if (locator != null) {
-      locator.installView(v);
+    if (this.locator != null) {
+      this.locator.installView(v);
     }
-    healthMon.installView(v);
-    messenger.installView(v);
-    manager.installView(v);
+    this.healthMon.installView(v);
+    this.messenger.installView(v);
+    this.manager.installView(v);
   }
 
   public void memberSuspected(InternalDistributedMember initiator,
       InternalDistributedMember suspect, String reason) {
     try {
-      joinLeave.memberSuspected(initiator, suspect, reason);
+      this.joinLeave.memberSuspected(initiator, suspect, reason);
     } finally {
       try {
-        healthMon.memberSuspected(initiator, suspect, reason);
+        this.healthMon.memberSuspected(initiator, suspect, reason);
       } finally {
         try {
-          auth.memberSuspected(initiator, suspect, reason);
+          this.auth.memberSuspected(initiator, suspect, reason);
         } finally {
           try {
-            messenger.memberSuspected(initiator, suspect, reason);
+            this.messenger.memberSuspected(initiator, suspect, reason);
           } finally {
-            manager.memberSuspected(initiator, suspect, reason);
+            this.manager.memberSuspected(initiator, suspect, reason);
           }
         }
       }
@@ -317,11 +319,11 @@ public class Services {
   }
 
   public Manager getManager() {
-    return manager;
+    return this.manager;
   }
 
   public Locator getLocator() {
-    return locator;
+    return this.locator;
   }
 
   public void setLocator(Locator locator) {
@@ -329,11 +331,11 @@ public class Services {
   }
 
   public JoinLeave getJoinLeave() {
-    return joinLeave;
+    return this.joinLeave;
   }
 
   public HealthMonitor getHealthMonitor() {
-    return healthMon;
+    return this.healthMon;
   }
 
   public ServiceConfig getConfig() {
@@ -357,11 +359,11 @@ public class Services {
   }
 
   public Exception getShutdownCause() {
-    return shutdownCause;
+    return this.shutdownCause;
   }
 
   public boolean isShutdownDueToForcedDisconnect() {
-    return shutdownCause instanceof ForcedDisconnectException;
+    return this.shutdownCause instanceof ForcedDisconnectException;
   }
 
   public boolean isAutoReconnectEnabled() {
@@ -369,8 +371,8 @@ public class Services {
   }
 
   public byte[] getPublicKey(InternalDistributedMember mbr) {
-    if (locator != null) {
-      return ((GMSLocator) locator).getPublicKey(mbr);
+    if (this.locator != null) {
+      return ((GMSLocator) this.locator).getPublicKey(mbr);
     }
     return null;
   }
@@ -386,7 +388,7 @@ public class Services {
     public String cancelInProgress() {
       if (Services.this.shutdownCause != null)
         return Services.this.shutdownCause.toString();
-      return reasonForStopping;
+      return this.reasonForStopping;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 2c69582..59020b8 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -727,26 +727,26 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
     return result;
   }
 
-  public static GemFireCacheImpl createClient(DistributedSystem system, PoolFactory pf,
+  public static GemFireCacheImpl createClient(InternalDistributedSystem system, PoolFactory pf,
       CacheConfig cacheConfig) {
     return basicCreate(system, true, cacheConfig, pf, true, ASYNC_EVENT_LISTENERS, null);
   }
 
-  public static GemFireCacheImpl create(DistributedSystem system, CacheConfig cacheConfig) {
+  public static GemFireCacheImpl create(InternalDistributedSystem system, CacheConfig cacheConfig) {
     return basicCreate(system, true, cacheConfig, null, false, ASYNC_EVENT_LISTENERS, null);
   }
 
-  static GemFireCacheImpl createWithAsyncEventListeners(DistributedSystem system,
+  static GemFireCacheImpl createWithAsyncEventListeners(InternalDistributedSystem system,
       CacheConfig cacheConfig, TypeRegistry typeRegistry) {
     return basicCreate(system, true, cacheConfig, null, false, true, typeRegistry);
   }
 
-  public static Cache create(DistributedSystem system, boolean existingOk,
+  public static Cache create(InternalDistributedSystem system, boolean existingOk,
       CacheConfig cacheConfig) {
     return basicCreate(system, existingOk, cacheConfig, null, false, ASYNC_EVENT_LISTENERS, null);
   }
 
-  private static GemFireCacheImpl basicCreate(DistributedSystem system, boolean existingOk,
+  private static GemFireCacheImpl basicCreate(InternalDistributedSystem system, boolean existingOk,
       CacheConfig cacheConfig, PoolFactory pf, boolean isClient, boolean asyncEventListeners,
       TypeRegistry typeRegistry) throws CacheExistsException, TimeoutException,
       CacheWriterException, GatewayException, RegionExistsException {
@@ -754,7 +754,6 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
       synchronized (GemFireCacheImpl.class) {
         GemFireCacheImpl instance = checkExistingCache(existingOk, cacheConfig);
         if (instance == null) {
-          // TODO:KIRK: create SecurityService
           instance = new GemFireCacheImpl(isClient, pf, system, cacheConfig, asyncEventListeners,
               typeRegistry);
           instance.initialize();
@@ -795,7 +794,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
    * 
    * @param typeRegistry: currently only unit tests set this parameter to a non-null value
    */
-  private GemFireCacheImpl(boolean isClient, PoolFactory pf, DistributedSystem system,
+  private GemFireCacheImpl(boolean isClient, PoolFactory pf, InternalDistributedSystem system,
       CacheConfig cacheConfig, boolean asyncEventListeners, TypeRegistry typeRegistry) {
     this.isClient = isClient;
     this.poolFactory = pf;
@@ -809,11 +808,10 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
       // start JTA transaction manager within this synchronized block
       // to prevent race with cache close. fixes bug 43987
       JNDIInvoker.mapTransactions(system);
-      this.system = (InternalDistributedSystem) system;
+      this.system = system;
       this.dm = this.system.getDistributionManager();
 
-      this.securityService =
-          SecurityServiceFactory.create(this.cacheConfig, this.system.getConfig());
+      this.securityService = this.system.getSecurityService();
 
       if (!this.isClient && PoolManager.getAll().isEmpty()) {
         // We only support management on members of a distributed system

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/internal/security/EnabledSecurityService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/security/EnabledSecurityService.java b/geode-core/src/main/java/org/apache/geode/internal/security/EnabledSecurityService.java
index 77b3fc2..4b59378 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/security/EnabledSecurityService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/security/EnabledSecurityService.java
@@ -78,7 +78,9 @@ public class EnabledSecurityService implements SecurityService {
   @Override
   public void initSecurity(final Properties securityProps) {
     this.securityManager.init(securityProps);
-    this.postProcessor.init(securityProps);
+    if (this.postProcessor != null) {
+      this.postProcessor.init(securityProps);
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/internal/security/SecurityServiceFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/security/SecurityServiceFactory.java b/geode-core/src/main/java/org/apache/geode/internal/security/SecurityServiceFactory.java
index 3cdc828..4453651 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/security/SecurityServiceFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/security/SecurityServiceFactory.java
@@ -34,10 +34,6 @@ public class SecurityServiceFactory {
     // do not instantiate
   }
 
-  /**
-   * Creates and initializes SecurityService. Initialization will invoke init on both
-   * SecurityManager and PostProcessor if they are specified.
-   */
   public static SecurityService create(CacheConfig cacheConfig,
       DistributionConfig distributionConfig) {
     Properties securityConfig = getSecurityConfig(distributionConfig);
@@ -45,16 +41,26 @@ public class SecurityServiceFactory {
         getSecurityManager(getSecurityManagerFromConfig(cacheConfig), securityConfig);
     PostProcessor postProcessor =
         getPostProcessor(getPostProcessorFromConfig(cacheConfig), securityConfig);
-
-    SecurityService securityService = create(securityConfig, securityManager, postProcessor);
-    securityService.initSecurity(distributionConfig.getSecurityProps());
-    return securityService;
+    return create(distributionConfig, securityManager, postProcessor);
   }
 
   /**
-   * Creates but does NOT initialize SecurityService. Init is NOTE invoked on either
+   * Creates and initializes SecurityService. Initialization will invoke init on both
    * SecurityManager and PostProcessor if they are specified.
    */
+  public static SecurityService create(DistributionConfig distributionConfig,
+      SecurityManager securityManager, PostProcessor postProcessor) {
+    Properties securityConfig = getSecurityConfig(distributionConfig);
+
+    SecurityService securityService = create(securityConfig, securityManager, postProcessor);
+    initialize(securityService, distributionConfig);
+    return securityService;
+  }
+
+  public static SecurityService create() {
+    return new DisabledSecurityService();
+  }
+
   public static SecurityService create(Properties securityConfig, SecurityManager securityManager,
       PostProcessor postProcessor) {
     SecurityServiceType type = determineType(securityConfig, securityManager);
@@ -172,4 +178,11 @@ public class SecurityServiceFactory {
     return securityConfig.getProperty(key);
   }
 
+  private static void initialize(SecurityService securityService,
+      DistributionConfig distributionConfig) {
+    if (securityService != null && distributionConfig != null) {
+      securityService.initSecurity(distributionConfig.getSecurityProps());
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/RecreateCacheFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/RecreateCacheFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/RecreateCacheFunction.java
index a00a79e..f25d1af 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/RecreateCacheFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/functions/RecreateCacheFunction.java
@@ -16,7 +16,7 @@ package org.apache.geode.management.internal.configuration.functions;
 
 import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.cache.CacheConfig;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
@@ -28,7 +28,7 @@ public class RecreateCacheFunction implements Function, InternalEntity {
   public void execute(FunctionContext context) {
     CliFunctionResult result = null;
     InternalCache cache = GemFireCacheImpl.getInstance();
-    DistributedSystem ds = cache.getDistributedSystem();
+    InternalDistributedSystem ds = cache.getInternalDistributedSystem();
     CacheConfig cacheConfig = cache.getCacheConfig();
     try {
       cache.close("Re-create Cache", true, true);

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java b/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
index dc73f04..c9b8d6b 100644
--- a/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesJUnitTest.java
@@ -55,6 +55,9 @@ public class AnalyzeSerializablesJUnitTest {
   /** all loaded classes */
   private Map<String, CompiledClass> classes;
 
+  private File expectedDataSerializablesFile;
+  private File expectedSerializablesFile;
+
   private List<ClassAndMethodDetails> expectedDataSerializables;
   private List<ClassAndVariableDetails> expectedSerializables;
 
@@ -76,18 +79,18 @@ public class AnalyzeSerializablesJUnitTest {
 
     // setup expectedDataSerializables
 
-    File expectedDataSerializablesFile = getResourceAsFile("sanctionedDataSerializables.txt");
-    assertThat(expectedDataSerializablesFile).exists().canRead();
+    this.expectedDataSerializablesFile = getResourceAsFile("sanctionedDataSerializables.txt");
+    assertThat(this.expectedDataSerializablesFile).exists().canRead();
 
-    this.expectedDataSerializables = loadClassesAndMethods(expectedDataSerializablesFile);
+    this.expectedDataSerializables = loadClassesAndMethods(this.expectedDataSerializablesFile);
     Collections.sort(this.expectedDataSerializables);
 
     // setup expectedSerializables
 
-    File expectedSerializablesFile = getResourceAsFile("sanctionedSerializables.txt");
-    assertThat(expectedSerializablesFile).exists().canRead();
+    this.expectedSerializablesFile = getResourceAsFile("sanctionedSerializables.txt");
+    assertThat(this.expectedSerializablesFile).exists().canRead();
 
-    this.expectedSerializables = loadClassesAndVariables(expectedSerializablesFile);
+    this.expectedSerializables = loadClassesAndVariables(this.expectedSerializablesFile);
     Collections.sort(this.expectedSerializables);
 
     // setup empty actual files
@@ -119,8 +122,8 @@ public class AnalyzeSerializablesJUnitTest {
       fail(
           diff + "\n\nIf the class is not persisted or sent over the wire add it to the excludedClasses.txt file in the "
               + "\norg/apache/geode/codeAnalysis directory.  Otherwise if this doesn't "
-              + "\nbreak backward compatibility move the file actualDataSerializables.dat to the codeAnalysis "
-              + "\ntest directory and rename to sanctionedDataSerializables.txt");
+              + "\nbreak backward compatibility move the file " + this.actualDataSerializablesFile.getAbsolutePath() + " to the codeAnalysis "
+              + "\ntest directory and rename to " + this.expectedDataSerializablesFile.getAbsolutePath());
     }
   }
 
@@ -139,8 +142,8 @@ public class AnalyzeSerializablesJUnitTest {
       fail(
           diff + "\n\nIf the class is not persisted or sent over the wire add it to the excludedClasses.txt file in the "
               + "\n/org/apache/geode/codeAnalysis/ directory.  Otherwise if this doesn't "
-              + "\nbreak backward compatibility move the file actualSerializables.dat to the "
-              + "\ncodeAnalysis test directory and rename to sanctionedSerializables.txt");
+              + "\nbreak backward compatibility move the file " + this.actualSerializablesFile.getAbsolutePath() + " to the "
+              + "\ncodeAnalysis test directory and rename to " + this.expectedSerializablesFile.getAbsolutePath());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
index f112d1a..a0c3cf3 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipJUnitTest.java
@@ -14,6 +14,13 @@
  */
 package org.apache.geode.distributed.internal.membership;
 
+import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_TCP;
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.MEMBER_TIMEOUT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -22,57 +29,48 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import java.io.File;
-import java.net.InetAddress;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.logging.log4j.Level;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
 import org.apache.geode.GemFireConfigException;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.Locator;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DMStats;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.distributed.internal.SerialAckedMessage;
 import org.apache.geode.distributed.internal.membership.gms.GMSUtil;
 import org.apache.geode.distributed.internal.membership.gms.ServiceConfig;
 import org.apache.geode.distributed.internal.membership.gms.Services;
 import org.apache.geode.distributed.internal.membership.gms.interfaces.JoinLeave;
 import org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave;
-import org.apache.geode.distributed.internal.membership.gms.messages.*;
+import org.apache.geode.distributed.internal.membership.gms.messages.HeartbeatMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.HeartbeatRequestMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.InstallViewMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.JoinRequestMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.JoinResponseMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.LeaveRequestMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.RemoveMemberMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.SuspectMembersMessage;
+import org.apache.geode.distributed.internal.membership.gms.messages.ViewAckMessage;
 import org.apache.geode.distributed.internal.membership.gms.mgr.GMSMembershipManager;
 import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.security.SecurityServiceFactory;
 import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.logging.log4j.Level;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import java.io.File;
+import java.net.InetAddress;
+import java.util.List;
+import java.util.Properties;
 
 @Category({IntegrationTest.class, MembershipJUnitTest.class})
 public class MembershipJUnitTest {
-  static Level baseLogLevel;
-
-  @BeforeClass
-  public static void setupClass() {
-    // baseLogLevel = LogService.getBaseLogLevel();
-    // LogService.setBaseLogLevel(Level.DEBUG);
-  }
-
-  @AfterClass
-  public static void tearDown() throws Exception {
-    // LogService.setBaseLogLevel(baseLogLevel);
-  }
-
-  // @Test
-  // public void testRepeat() throws Exception {
-  // for (int i=0; i<50; i++) {
-  // System.out.println("--------------------run #" + i);
-  // testMultipleManagersInSameProcess();
-  // }
-  // }
 
   /**
    * This test creates a locator with a colocated membership manager and then creates a second
@@ -152,7 +150,8 @@ public class MembershipJUnitTest {
         DistributedMembershipListener listener1 = mock(DistributedMembershipListener.class);
         DMStats stats1 = mock(DMStats.class);
         System.out.println("creating 1st membership manager");
-        m1 = MemberFactory.newMembershipManager(listener1, config, transport, stats1);
+        m1 = MemberFactory.newMembershipManager(listener1, config, transport, stats1,
+            SecurityServiceFactory.create());
         m1.startEventProcessing();
       } finally {
         System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
@@ -162,7 +161,8 @@ public class MembershipJUnitTest {
       DistributedMembershipListener listener2 = mock(DistributedMembershipListener.class);
       DMStats stats2 = mock(DMStats.class);
       System.out.println("creating 2nd membership manager");
-      m2 = MemberFactory.newMembershipManager(listener2, config, transport, stats2);
+      m2 = MemberFactory.newMembershipManager(listener2, config, transport, stats2,
+          SecurityServiceFactory.create());
       m2.startEventProcessing();
 
       // we have to check the views with JoinLeave because the membership
@@ -292,7 +292,8 @@ public class MembershipJUnitTest {
         DistributedMembershipListener listener1 = mock(DistributedMembershipListener.class);
         DMStats stats1 = mock(DMStats.class);
         System.out.println("creating 1st membership manager");
-        m1 = MemberFactory.newMembershipManager(listener1, config, transport, stats1);
+        m1 = MemberFactory.newMembershipManager(listener1, config, transport, stats1,
+            SecurityServiceFactory.create());
         m1.startEventProcessing();
       } finally {
         System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
@@ -302,7 +303,8 @@ public class MembershipJUnitTest {
       DistributedMembershipListener listener2 = mock(DistributedMembershipListener.class);
       DMStats stats2 = mock(DMStats.class);
       System.out.println("creating 2nd membership manager");
-      m2 = MemberFactory.newMembershipManager(listener2, config, transport, stats2);
+      m2 = MemberFactory.newMembershipManager(listener2, config, transport, stats2,
+          SecurityServiceFactory.create());
       m2.startEventProcessing();
 
       // we have to check the views with JoinLeave because the membership

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
index 423d7e1..40c058b 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/gms/locator/GMSLocatorRecoveryJUnitTest.java
@@ -14,18 +14,34 @@
  */
 package org.apache.geode.distributed.internal.membership.gms.locator;
 
+import static org.apache.geode.distributed.ConfigurationProperties.BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_TCP;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
 import org.apache.geode.DataSerializer;
 import org.apache.geode.InternalGemFireException;
 import org.apache.geode.distributed.Locator;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.DMStats;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.distributed.internal.LocatorStats;
 import org.apache.geode.distributed.internal.membership.DistributedMembershipListener;
 import org.apache.geode.distributed.internal.membership.MemberFactory;
 import org.apache.geode.distributed.internal.membership.MembershipManager;
 import org.apache.geode.distributed.internal.membership.NetView;
 import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.Version;
 import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.security.SecurityServiceFactory;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.MembershipTest;
 import org.junit.After;
@@ -39,30 +55,27 @@ import java.io.ObjectOutputStream;
 import java.net.InetAddress;
 import java.util.Properties;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-
 @Category({IntegrationTest.class, MembershipTest.class})
 public class GMSLocatorRecoveryJUnitTest {
 
-  File tempStateFile = null;
-  GMSLocator locator = null;
+  private File tempStateFile;
+  private GMSLocator locator;
 
   @Before
   public void setUp() throws Exception {
-    tempStateFile = new File("GMSLocatorJUnitTest_locator.dat");
-    if (tempStateFile.exists()) {
-      tempStateFile.delete();
+    this.tempStateFile = new File("GMSLocatorJUnitTest_locator.dat");
+    if (this.tempStateFile.exists()) {
+      this.tempStateFile.delete();
     }
-    locator = new GMSLocator(null, tempStateFile, null, false, false, new LocatorStats(), "");
+    this.locator =
+        new GMSLocator(null, this.tempStateFile, null, false, false, new LocatorStats(), "");
     // System.out.println("temp state file: " + tempStateFile);
   }
 
   @After
   public void tearDown() throws Exception {
-    if (tempStateFile.exists()) {
-      tempStateFile.delete();
+    if (this.tempStateFile.exists()) {
+      this.tempStateFile.delete();
     }
   }
 
@@ -78,31 +91,34 @@ public class GMSLocatorRecoveryJUnitTest {
 
   @Test
   public void testRecoverFromFileWithNonExistFile() throws Exception {
-    tempStateFile.delete();
-    assertFalse(tempStateFile.exists());
-    assertFalse(locator.recoverFromFile(tempStateFile));
+    this.tempStateFile.delete();
+    assertFalse(this.tempStateFile.exists());
+    assertFalse(this.locator.recoverFromFile(this.tempStateFile));
   }
 
   @Test
   public void testRecoverFromFileWithNormalFile() throws Exception {
     NetView view = new NetView();
-    populateStateFile(tempStateFile, GMSLocator.LOCATOR_FILE_STAMP, Version.CURRENT_ORDINAL, view);
-    assertTrue(locator.recoverFromFile(tempStateFile));
+    populateStateFile(this.tempStateFile, GMSLocator.LOCATOR_FILE_STAMP, Version.CURRENT_ORDINAL,
+        view);
+    assertTrue(this.locator.recoverFromFile(this.tempStateFile));
   }
 
   @Test
   public void testRecoverFromFileWithWrongFileStamp() throws Exception {
     // add 1 to file stamp to make it invalid
-    populateStateFile(tempStateFile, GMSLocator.LOCATOR_FILE_STAMP + 1, Version.CURRENT_ORDINAL, 1);
-    assertFalse(locator.recoverFromFile(tempStateFile));
+    populateStateFile(this.tempStateFile, GMSLocator.LOCATOR_FILE_STAMP + 1,
+        Version.CURRENT_ORDINAL, 1);
+    assertFalse(this.locator.recoverFromFile(this.tempStateFile));
   }
 
   @Test
   public void testRecoverFromFileWithWrongOrdinal() throws Exception {
     // add 1 to ordinal to make it wrong
-    populateStateFile(tempStateFile, GMSLocator.LOCATOR_FILE_STAMP, Version.CURRENT_ORDINAL + 1, 1);
+    populateStateFile(this.tempStateFile, GMSLocator.LOCATOR_FILE_STAMP,
+        Version.CURRENT_ORDINAL + 1, 1);
     try {
-      locator.recoverFromFile(tempStateFile);
+      this.locator.recoverFromFile(this.tempStateFile);
       fail("expected an InternalGemFireException to be thrown");
     } catch (InternalGemFireException e) {
       // success
@@ -111,9 +127,10 @@ public class GMSLocatorRecoveryJUnitTest {
 
   @Test
   public void testRecoverFromFileWithInvalidViewObject() throws Exception {
-    populateStateFile(tempStateFile, GMSLocator.LOCATOR_FILE_STAMP, Version.CURRENT_ORDINAL, 1);
+    populateStateFile(this.tempStateFile, GMSLocator.LOCATOR_FILE_STAMP, Version.CURRENT_ORDINAL,
+        1);
     try {
-      locator.recoverFromFile(tempStateFile);
+      this.locator.recoverFromFile(this.tempStateFile);
       fail("should catch InternalGemFileException");
     } catch (InternalGemFireException e) {
       assertTrue(e.getMessage().startsWith("Unable to recover previous membership view from"));
@@ -153,7 +170,8 @@ public class GMSLocatorRecoveryJUnitTest {
       // start the first membership manager
       DistributedMembershipListener listener1 = mock(DistributedMembershipListener.class);
       DMStats stats1 = mock(DMStats.class);
-      m1 = MemberFactory.newMembershipManager(listener1, config, transport, stats1);
+      m1 = MemberFactory.newMembershipManager(listener1, config, transport, stats1,
+          SecurityServiceFactory.create());
 
       // hook up the locator to the membership manager
       ((InternalLocator) l).getLocatorHandler().setMembershipManager(m1);

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceFactoryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceFactoryTest.java b/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceFactoryTest.java
index 93a93da..0f2a5d9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceFactoryTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/security/SecurityServiceFactoryTest.java
@@ -32,9 +32,8 @@ import org.junit.experimental.categories.Category;
 public class SecurityServiceFactoryTest {
 
   @Test
-  public void getPostProcessor_null_throwsNPE() throws Exception {
-    assertThatThrownBy(() -> SecurityServiceFactory.getPostProcessor(null, null))
-        .isExactlyInstanceOf(NullPointerException.class);
+  public void getPostProcessor_null_returnsNull() throws Exception {
+    assertThat(SecurityServiceFactory.getPostProcessor(null, null)).isNull();
   }
 
   @Test
@@ -46,7 +45,7 @@ public class SecurityServiceFactoryTest {
   }
 
   @Test
-  public void getPostProcessor_SecurityConfig_initsPostProcessor() throws Exception {
+  public void getPostProcessor_SecurityConfig_createsPostProcessor() throws Exception {
     Properties securityConfig = new Properties();
     securityConfig.setProperty(SECURITY_POST_PROCESSOR, FakePostProcessor.class.getName());
 
@@ -56,8 +55,8 @@ public class SecurityServiceFactoryTest {
 
     FakePostProcessor fakePostProcessor = (FakePostProcessor) postProcessor;
 
-    assertThat(fakePostProcessor.getInitInvocations()).isEqualTo(1);
-    assertThat(fakePostProcessor.getSecurityProps()).isSameAs(securityConfig);
+    assertThat(fakePostProcessor.getInitInvocations()).isEqualTo(0);
+    assertThat(fakePostProcessor.getSecurityProps()).isNull();
   }
 
   @Test
@@ -71,9 +70,8 @@ public class SecurityServiceFactoryTest {
   }
 
   @Test
-  public void getSecurityManager_null_throwsNPE() throws Exception {
-    assertThatThrownBy(() -> SecurityServiceFactory.getSecurityManager(null, null))
-        .isExactlyInstanceOf(NullPointerException.class);
+  public void getSecurityManager_null_returnsNull() throws Exception {
+    assertThat(SecurityServiceFactory.getSecurityManager(null, null)).isNull();
   }
 
   @Test
@@ -85,7 +83,7 @@ public class SecurityServiceFactoryTest {
   }
 
   @Test
-  public void getSecurityManager_SecurityConfig_initsSecurityManager() throws Exception {
+  public void getSecurityManager_SecurityConfig_createsSecurityManager() throws Exception {
     Properties securityConfig = new Properties();
     securityConfig.setProperty(SECURITY_MANAGER, FakeSecurityManager.class.getName());
 
@@ -96,8 +94,8 @@ public class SecurityServiceFactoryTest {
 
     FakeSecurityManager fakeSecurityManager = (FakeSecurityManager) securityManager;
 
-    assertThat(fakeSecurityManager.getInitInvocations()).isEqualTo(1);
-    assertThat(fakeSecurityManager.getSecurityProps()).isSameAs(securityConfig);
+    assertThat(fakeSecurityManager.getInitInvocations()).isEqualTo(0);
+    assertThat(fakeSecurityManager.getSecurityProps()).isNull();
   }
 
   @Test
@@ -111,9 +109,9 @@ public class SecurityServiceFactoryTest {
   }
 
   @Test
-  public void determineType_null_throwsNPE() throws Exception {
-    assertThatThrownBy(() -> SecurityServiceFactory.determineType(null, null))
-        .isExactlyInstanceOf(NullPointerException.class);
+  public void determineType_null_returnsDISABLED() throws Exception {
+    assertThat(SecurityServiceFactory.determineType(null, null))
+        .isSameAs(SecurityServiceType.DISABLED);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/f051e803/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 015a480..9f47bd0 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
@@ -88,7 +88,7 @@ public class Server {
 
       SecurityService securityService =
           SecurityServiceFactory.create(securityProperties, new TestSecurityManager(), null);
-      securityService.initSecurity(securityProperties); // TODO:KIRK: clean this up
+      securityService.initSecurity(securityProperties);
 
       // wire in the authenticator and authorizaton
       JMXShiroAuthenticator interceptor = new JMXShiroAuthenticator(securityService);


Mime
View raw message