GEODE-1397: Fixing testOfflineHelp

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

Branch: refs/heads/develop
Commit: cafda19311588efd43f56736aaab26a66365f58d
Parents: dd8ea42
Author: Jens Deppe <jde...@pivotal.io>
Authored: Wed May 18 14:29:43 2016 -0700
Committer: Jens Deppe <jde...@pivotal.io>
Committed: Thu May 19 19:34:51 2016 -0700

----------------------------------------------------------------------
 .../commands/HelpCommandsIntegrationTest.java   | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/cafda193/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsIntegrationTest.java
 
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsIntegrationTest.java
index 5d43a0e..2c048fc 100644
--- 
a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsIntegrationTest.java
+++ 
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/HelpCommandsIntegrationTest.java
@@ -16,7 +16,9 @@
  */
 package com.gemstone.gemfire.management.internal.cli.commands;
 
+import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.management.internal.cli.CommandManager;
 import com.gemstone.gemfire.management.internal.cli.parser.CommandTarget;
@@ -27,8 +29,10 @@ import 
com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.ClassRule;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.junit.contrib.java.lang.system.ProvideSystemProperty;
 import org.junit.experimental.categories.Category;
 
 import java.util.Map;
@@ -39,12 +43,15 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 @Category(IntegrationTest.class)
-public class HelpCommandsIntegrationTest extends JUnit4DistributedTestCase {
+public class HelpCommandsIntegrationTest {
 
   private int jmxPort;
 
   private Gfsh gfsh;
 
+  @ClassRule
+  public static final ProvideSystemProperty isGfsh = new 
ProvideSystemProperty("gfsh", "true");
+
   @Before
   public void setup() throws Exception {
     jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
@@ -53,19 +60,20 @@ public class HelpCommandsIntegrationTest extends 
JUnit4DistributedTestCase {
     localProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
     localProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
     localProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, 
String.valueOf(jmxPort));
-    getSystem(localProps);
+
+    new CacheFactory(localProps).create();
 
     gfsh = Gfsh.getInstance(false, new String[0], new GfshConfig());
   }
 
   @After
   public void teardown() {
-    disconnectAllFromDS();
-
-    gfsh.executeCommand("disconnect");
+    InternalDistributedSystem ids = 
InternalDistributedSystem.getConnectedInstance();
+    if (ids != null) {
+      ids.disconnect();
+    }
   }
 
-  @Ignore("Disconnect command doesn't appear to be working")
   @Test
   public void testOfflineHelp() throws Exception {
     Properties helpProps = new Properties();

Reply via email to