Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-3062-2 77eed82a3 -> 30228dae8


Fixup


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

Branch: refs/heads/feature/GEODE-3062-2
Commit: 30228dae8969c1017e06d6e072c1ceca9e40f43a
Parents: 77eed82
Author: Kirk Lund <[email protected]>
Authored: Thu Jun 15 14:50:45 2017 -0700
Committer: Kirk Lund <[email protected]>
Committed: Thu Jun 15 14:50:45 2017 -0700

----------------------------------------------------------------------
 .../SecurityClusterConfigDUnitTest.java         |  9 ------
 .../test/dunit/rules/ServerStarterRule.java     | 33 ++++++++++++++------
 2 files changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/30228dae/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
index 7193f17..46767ff 100644
--- 
a/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/security/SecurityClusterConfigDUnitTest.java
@@ -21,7 +21,6 @@ import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANA
 import static 
org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
 import static 
org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
 import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
-import static 
org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase.disconnectAllFromDS;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
@@ -32,7 +31,6 @@ 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;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -51,8 +49,6 @@ public class SecurityClusterConfigDUnitTest {
 
   @Before
   public void before() throws Exception {
-    disconnectAllFromDS();
-
     
addIgnoredException(LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION.toString());
     
addIgnoredException(LocalizedStrings.GEMFIRE_CACHE_SECURITY_MISCONFIGURATION_2.toString());
 
@@ -66,11 +62,6 @@ public class SecurityClusterConfigDUnitTest {
     this.lsRule.startLocatorVM(0, props);
   }
 
-  @After
-  public void after() {
-    disconnectAllFromDS();
-  }
-
   @Test
   public void testStartServerWithClusterConfig() throws Exception {
     Properties props = new Properties();

http://git-wip-us.apache.org/repos/asf/geode/blob/30228dae/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 fa3e8c0..78f8c60 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
@@ -12,7 +12,6 @@
  * or implied. See the License for the specific language governing permissions 
and limitations under
  * the License.
  */
-
 package org.apache.geode.test.dunit.rules;
 
 import static 
org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
@@ -22,6 +21,7 @@ import static 
org.apache.geode.distributed.ConfigurationProperties.START_DEV_RES
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.AvailablePortHelper;
@@ -34,7 +34,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
-
 /**
  * This is a rule to start up a server in your current VM. It's useful for 
your Integration Tests.
  *
@@ -51,6 +50,7 @@ import java.util.Properties;
  * use {@link LocatorServerStartupRule}.
  */
 public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> 
implements Server {
+
   private transient InternalCache cache;
   private transient CacheServer server;
   private int embeddedLocatorPort = -1;
@@ -62,7 +62,9 @@ public class ServerStarterRule extends 
MemberStarterRule<ServerStarterRule> impl
    * Default constructor, if used, the rule will create a temporary folder as 
the server's working
    * dir, and will delete it when the test is done.
    */
-  public ServerStarterRule() {}
+  public ServerStarterRule() {
+    // nothing
+  }
 
   /**
    * if constructed this way, the rule won't be deleting the workingDir after 
the test is done. It's
@@ -108,14 +110,28 @@ public class ServerStarterRule extends 
MemberStarterRule<ServerStarterRule> impl
   public void stopMember() {
     // make sure this cache is the one currently open. A server cache can be 
recreated due to
     // importing a new set of cluster configuration.
+    if (server != null) {
+      try {
+        server.stop();
+      } catch (Exception e) {
+      } finally {
+        server = null;
+      }
+    }
+
     cache = GemFireCacheImpl.getInstance();
     if (cache != null) {
-      cache.close();
-      cache = null;
+      try {
+        cache.close();
+      } catch (Exception e) {
+      } finally {
+        cache = null;
+      }
     }
-    if (server != null) {
-      server.stop();
-      server = null;
+
+    DistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
+    if (ds != null) {
+      ds.disconnect();
     }
   }
 
@@ -125,7 +141,6 @@ public class ServerStarterRule extends 
MemberStarterRule<ServerStarterRule> impl
   }
 
 
-
   public ServerStarterRule withEmbeddedLocator() {
     embeddedLocatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
     properties.setProperty("start-locator", "localhost[" + embeddedLocatorPort 
+ "]");

Reply via email to