From 063176e2a285b61446e09ec713c6fa25e01f8e68 Mon Sep 17 00:00:00 2001 From: dengliming Date: Wed, 23 Sep 2020 21:44:57 +0800 Subject: [PATCH] Remove deprecated --setup / --show-system-properties option (#37) --- README.md | 7 +------ src/main/java/am/ik/rsocket/Args.java | 21 +-------------------- src/test/java/am/ik/rsocket/ArgsTest.java | 8 -------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 4d0192c..ff5f969 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/main/java/am/ik/rsocket/Args.java b/src/main/java/am/ik/rsocket/Args.java index b32761d..d501c4b 100644 --- a/src/main/java/am/ik/rsocket/Args.java +++ b/src/main/java/am/ik/rsocket/Args.java @@ -117,9 +117,6 @@ public class Args { private final OptionSpec setupData = parser.acceptsAll(Arrays.asList("setupData", "sd"), "Data for Setup payload") .withOptionalArg(); - private final OptionSpec setupDataDeprecated = parser.acceptsAll(Arrays.asList("s", "setup"), "[DEPRECATED] Data for Setup payload. Use --setupData or --sd instead.") - .withOptionalArg(); - private final OptionSpec setupMetadata = parser.acceptsAll(Arrays.asList("sm", "setupMetadata"), "Metadata for Setup payload") .withOptionalArg(); @@ -165,9 +162,6 @@ public class Args { private final OptionSpec showSystemProperties = parser.acceptsAll(Arrays.asList("showSystemProperties"), "Show SystemProperties for troubleshoot"); - private final OptionSpec showSystemPropertiesDeprecated = parser.acceptsAll(Arrays.asList("show-system-properties"), - "[DEPRECATED] Show SystemProperties for troubleshoot. Use --showSystemProperties instead."); - private final OptionSpec wsHeader = parser.acceptsAll(Arrays.asList("wsh", "wsHeader"), "Header for web socket connection") .withOptionalArg(); @@ -287,16 +281,7 @@ public String dataMimeType() { } private Optional setupData() { - final OptionSpec 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."); @@ -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); } } diff --git a/src/test/java/am/ik/rsocket/ArgsTest.java b/src/test/java/am/ik/rsocket/ArgsTest.java index 211e349..1c3971a 100644 --- a/src/test/java/am/ik/rsocket/ArgsTest.java +++ b/src/test/java/am/ik/rsocket/ArgsTest.java @@ -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");