Skip to content

Commit

Permalink
Remove deprecated --setup / --show-system-properties option (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
dengliming authored Sep 23, 2020
1 parent 983136f commit 063176e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 34 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ Option Description
can be configured in seconds.
--retry [Integer] Enable retry. Retry every 1 second
with the given max attempts.
-s, --setup [String] [DEPRECATED] Data for Setup payload.
Use --setupData or --sd instead.
--sd, --setupData [String] Data for Setup payload
--setupMetadata, --sm [String] Metadata for Setup payload
--setupMetadataMimeType, --smmt Metadata MimeType for Setup payload
[String] (default: application/json)
--show-system-properties [DEPRECATED] Show SystemProperties for
troubleshoot. Use --
showSystemProperties instead.
[String] (default: application/json)
--showSystemProperties Show SystemProperties for troubleshoot
--stacktrace Show Stacktrace when an exception
happens
Expand Down
21 changes: 1 addition & 20 deletions src/main/java/am/ik/rsocket/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ public class Args {
private final OptionSpec<String> setupData = parser.acceptsAll(Arrays.asList("setupData", "sd"), "Data for Setup payload")
.withOptionalArg();

private final OptionSpec<String> setupDataDeprecated = parser.acceptsAll(Arrays.asList("s", "setup"), "[DEPRECATED] Data for Setup payload. Use --setupData or --sd instead.")
.withOptionalArg();

private final OptionSpec<String> setupMetadata = parser.acceptsAll(Arrays.asList("sm", "setupMetadata"), "Metadata for Setup payload")
.withOptionalArg();

Expand Down Expand Up @@ -165,9 +162,6 @@ public class Args {
private final OptionSpec<Void> showSystemProperties = parser.acceptsAll(Arrays.asList("showSystemProperties"),
"Show SystemProperties for troubleshoot");

private final OptionSpec<Void> showSystemPropertiesDeprecated = parser.acceptsAll(Arrays.asList("show-system-properties"),
"[DEPRECATED] Show SystemProperties for troubleshoot. Use --showSystemProperties instead.");

private final OptionSpec<String> wsHeader = parser.acceptsAll(Arrays.asList("wsh", "wsHeader"), "Header for web socket connection")
.withOptionalArg();

Expand Down Expand Up @@ -287,16 +281,7 @@ public String dataMimeType() {
}

private Optional<ByteBuf> setupData() {
final OptionSpec<String> setupData;
if (this.options.has(this.setupDataDeprecated)) {
System.err.println("[WARNING] --setup / -s option is deprecated. Use --setupData / --sd instead.");
setupData = this.setupDataDeprecated;
}
else {
setupData = this.setupData;
}

if (this.options.has(setupData)) {
if (this.options.has(this.setupData)) {
final String data = this.options.valueOf(setupData);
if (data == null) {
throw new IllegalArgumentException("'setupData' is not specified.");
Expand Down Expand Up @@ -637,10 +622,6 @@ public void printHelp(PrintStream stream) {
}

public boolean showSystemProperties() {
if (this.options.has(this.showSystemPropertiesDeprecated)) {
System.err.println("[WARNING] --show-system-properties option is deprecated. Use --showSystemProperties instead.");
return true;
}
return this.options.has(this.showSystemProperties);
}
}
8 changes: 0 additions & 8 deletions src/test/java/am/ik/rsocket/ArgsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,6 @@ void setupData() {
assertThat(args.setupPayload().get().getMetadataUtf8()).isEqualTo("");
}

@Test
void setupDataDeprecated() {
final Args args = new Args("tcp://localhost:8080 -s hello");
assertThat(args.setupPayload().isPresent()).isTrue();
assertThat(args.setupPayload().get().getDataUtf8()).isEqualTo("hello");
assertThat(args.setupPayload().get().getMetadataUtf8()).isEqualTo("");
}

@Test
void setupDataMissing() {
final Args args = new Args("tcp://localhost:8080 --sd");
Expand Down

0 comments on commit 063176e

Please sign in to comment.