GEODE-647: fix GfshParserJUnitTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/80c61f4f Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/80c61f4f Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/80c61f4f Branch: refs/heads/feature/GEODE-291 Commit: 80c61f4fd38114591cadc3fa28209206f66a2c3f Parents: b0419b1 Author: Jens Deppe <[email protected]> Authored: Fri Dec 11 13:33:18 2015 -0800 Committer: Jens Deppe <[email protected]> Committed: Fri Dec 11 13:45:01 2015 -0800 ---------------------------------------------------------------------- .../internal/cli/GfshParserJUnitTest.java | 50 ++++++++------------ .../internal/cli/HeadlessGfshJUnitTest.java | 7 ++- 2 files changed, 24 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80c61f4f/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/GfshParserJUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/GfshParserJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/GfshParserJUnitTest.java index 68fe251..f28b5cc 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/GfshParserJUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/GfshParserJUnitTest.java @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.List; import org.junit.After; -import org.junit.Ignore; +import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.springframework.shell.core.CommandMarker; @@ -134,6 +134,26 @@ public class GfshParserJUnitTest { private static final Completion[] OPTION3_COMPLETIONS = { new Completion("option3"), new Completion("option3Alternate") }; + private CommandManager commandManager; + + private GfshParser parser; + + @Before + public void setUp() throws Exception { + // Make sure no prior tests leave the CommandManager in a funky state + CommandManager.clearInstance(); + + commandManager = CommandManager.getInstance(false); + commandManager.add(Commands.class.newInstance()); + commandManager.add(SimpleConverter.class.newInstance()); + commandManager.add(StringArrayConverter.class.newInstance()); + commandManager.add(StringListConverter.class.newInstance()); + // Set up the parser + parser = new GfshParser(commandManager); + + CliUtil.isGfshVM = false; + } + @After public void tearDown() { CommandManager.clearInstance(); @@ -150,14 +170,6 @@ public class GfshParserJUnitTest { */ @Test public void testComplete() throws Exception { - // get a CommandManager, add sample commands - CommandManager commandManager = CommandManager.getInstance(false); - assertNotNull("CommandManager should not be null.", commandManager); - commandManager.add(Commands.class.newInstance()); - commandManager.add(SimpleConverter.class.newInstance()); - // Set up the parser - GfshParser parser = new GfshParser(commandManager); - // Get the names of the command String[] command1Names = ((CliCommand) METHOD_command1 .getAnnotation(CliCommand.class)).value(); @@ -454,14 +466,6 @@ public class GfshParserJUnitTest { */ @Test public void testCompleteAdvanced() throws Exception { - // get a CommandManager, add sample commands - CommandManager commandManager = CommandManager.getInstance(false); - assertNotNull("CommandManager should not be null.", commandManager); - commandManager.add(Commands.class.newInstance()); - commandManager.add(SimpleConverter.class.newInstance()); - // Set up the parser - GfshParser parser = new GfshParser(commandManager); - // Get the names of the command String[] command1Names = ((CliCommand) METHOD_command1 .getAnnotation(CliCommand.class)).value(); @@ -778,19 +782,7 @@ public class GfshParserJUnitTest { * @throws SecurityException */ @Test - @Ignore("GEODE-647") public void testParse() throws Exception { - // get a CommandManager, add sample commands - CommandManager commandManager = CommandManager.getInstance(false); - assertNotNull("CommandManager should not be null.", commandManager); - commandManager.add(StringArrayConverter.class.newInstance()); - commandManager.add(StringListConverter.class.newInstance()); - commandManager.add(SimpleConverter.class.newInstance()); - commandManager.add(Commands.class.newInstance()); - - // Set up the parser - GfshParser parser = new GfshParser(commandManager); - // Get the names of the command String[] command1Names = ((CliCommand) METHOD_command1 .getAnnotation(CliCommand.class)).value(); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/80c61f4f/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java index 0807898..6053494 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/management/internal/cli/HeadlessGfshJUnitTest.java @@ -22,7 +22,7 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig; import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.management.internal.MBeanJMXAdapter; -import com.gemstone.gemfire.test.junit.categories.UnitTest; +import com.gemstone.gemfire.test.junit.categories.IntegrationTest; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -38,10 +38,10 @@ import static org.junit.Assert.assertTrue; * * @author tushark */ -@Category(UnitTest.class) +@Category(IntegrationTest.class) public class HeadlessGfshJUnitTest { - @SuppressWarnings({"unused", "deprecation", "unused"}) + @SuppressWarnings({"deprecation"}) @Test public void testHeadlessGfshTest() throws ClassNotFoundException, IOException, InterruptedException { GemFireCacheImpl cache = null; @@ -57,7 +57,6 @@ public class HeadlessGfshJUnitTest { ds = DistributedSystem.connect(pr); cache = (GemFireCacheImpl) CacheFactory.create(ds); - ObjectName name = MBeanJMXAdapter.getDistributedSystemName(); HeadlessGfsh gfsh = new HeadlessGfsh("Test", 25); for (int i = 0; i < 5; i++) {
