[ https://issues.apache.org/jira/browse/GEODE-7667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17095746#comment-17095746 ]
ASF GitHub Bot commented on GEODE-7667: --------------------------------------- BenjaminPerryRoss commented on a change in pull request #4818: URL: https://github.com/apache/geode/pull/4818#discussion_r417509072 ########## File path: geode-gfsh/src/test/java/org/apache/geode/management/internal/cli/commands/ClearCommandTest.java ########## @@ -0,0 +1,93 @@ +package org.apache.geode.management.internal.cli.commands; + +import static org.apache.geode.management.internal.i18n.CliStrings.CLEAR_REGION; +import static org.apache.geode.management.internal.i18n.CliStrings.CLEAR_REGION_REGION_NAME; +import static org.apache.geode.management.internal.cli.commands.ClearCommand.REGION_NOT_FOUND; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.HashSet; +import java.util.Set; + +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; + +import org.apache.geode.cache.Cache; +import org.apache.geode.cache.Region; +import org.apache.geode.distributed.DistributedMember; +import org.apache.geode.internal.cache.InternalCache; +import org.apache.geode.management.internal.cli.domain.DataCommandRequest; +import org.apache.geode.management.internal.cli.domain.DataCommandResult; +import org.apache.geode.management.internal.cli.functions.DataCommandFunction; +import org.apache.geode.management.internal.cli.result.model.ResultModel; +import org.apache.geode.test.junit.rules.GfshParserRule; + +public class ClearCommandTest { Review comment: Originally I was calling clear directly but that introduce complications with the test needing to hardcode the parsing of ResultModel since we weren't using the gfsh tools that come with the gfsh rule. Ultimately I decided that using the gfsh rule and relying on the gfsh command line parsing to call the the actual method we're testing was the lesser of two evils in that regard. I have added the verifications, I agree they improve the quality of the test. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > GFSH commands - uniform gfsh command to clear regions > ----------------------------------------------------- > > Key: GEODE-7667 > URL: https://issues.apache.org/jira/browse/GEODE-7667 > Project: Geode > Issue Type: Sub-task > Components: regions > Reporter: Nabarun Nag > Assignee: Benjamin P Ross > Priority: Major > Labels: GeodeCommons, docs > Time Spent: 5h > Remaining Estimate: 0h > > * Currently, the gfsh command to clear replicated region is called ‘remove > —region=/regionName’. > * Replace this command with ‘clear region —region=regionName’ > * While executing this gfsh command on partitioned regions, this should call > the clear() Java API using the gfsh function execution machinery. > * Point to note is that this command should take into consideration of the > coordinator selection and how this command is distributed to the members > Acceptance : > * There should be ‘clear region —region=/regionName’ gfsh command > * DUnit tests to verify that command can be executed successfully on > PartitionedRegion > * Deprecate the remove command, as remove does not mean clear > * Unit tests with complete code coverage for the newly written code. > * Test coverage to when a member departs in this scenario > * Test coverage to when a member restarts in this scenario -- This message was sent by Atlassian Jira (v8.3.4#803005)