Skip to content

Commit

Permalink
GEODE-9034: Make mandatory options to appear first when creating gate… (
Browse files Browse the repository at this point in the history
apache#6136)

* GEODE-9034: Make mandatory options to appear first when creating gateway sender from gfsh

* GEODE-9034: Added test cases
  • Loading branch information
albertogpz authored Mar 24, 2021
1 parent a5bd36f commit 15bbd42
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,22 @@ public void testIndexType() {
.hasSize(org.apache.geode.cache.query.IndexType.values().length);
assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + "hash");
}

@Test
public void testCompletionCreateGatewaySenderWithSpace() {
String buffer = "create gateway-sender ";
CommandCandidate candidate = gfshParserRule.complete(buffer);
assertThat(candidate.getCandidates()).hasSize(2);
assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + "--id");
assertThat(candidate.getCandidates().get(1).getValue())
.isEqualTo(buffer + "--remote-distributed-system-id");
}

@Test
public void testCompletionCreateGatewaySenderWithDash() {
String buffer = "create gateway-sender --";
CommandCandidate candidate = gfshParserRule.complete(buffer);
assertThat(candidate.getCandidates()).hasSize(1);
assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + "id");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ public class CreateGatewaySenderCommand extends SingleGfshCommand {
operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY)
public ResultModel createGatewaySender(

@CliOption(key = CliStrings.CREATE_GATEWAYSENDER__ID,
mandatory = true,
help = CliStrings.CREATE_GATEWAYSENDER__ID__HELP) String id,

@CliOption(key = CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID,
mandatory = true,
help = CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID__HELP) Integer remoteDistributedSystemId,

@CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
optionContext = ConverterHint.MEMBERGROUP,
help = CliStrings.CREATE_GATEWAYSENDER__GROUP__HELP) String[] onGroups,
Expand All @@ -67,13 +75,6 @@ public ResultModel createGatewaySender(
optionContext = ConverterHint.MEMBERIDNAME,
help = CliStrings.CREATE_GATEWAYSENDER__MEMBER__HELP) String[] onMember,

@CliOption(key = CliStrings.CREATE_GATEWAYSENDER__ID,
mandatory = true,
help = CliStrings.CREATE_GATEWAYSENDER__ID__HELP) String id,

@CliOption(key = CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID,
mandatory = true,
help = CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID__HELP) Integer remoteDistributedSystemId,

@CliOption(key = CliStrings.CREATE_GATEWAYSENDER__GROUPTRANSACTIONEVENTS,
specifiedDefaultValue = "true",
Expand Down

0 comments on commit 15bbd42

Please sign in to comment.