Conversation
msgilligan
left a comment
There was a problem hiding this comment.
I know this is a draft, but I have a couple suggestions
consensusj-jrpc-echod/src/main/java/org/consensusj/jsonrpc/daemon/EchoJsonRpcService.java
Outdated
Show resolved
Hide resolved
consensusj-jrpc-echod/src/main/java/org/consensusj/jsonrpc/daemon/EchoJsonRpcService.java
Outdated
Show resolved
Hide resolved
consensusj-jrpc-echod/src/test/java/org/consensusj/jsonrpc/daemon/ApplicationTest.java
Outdated
Show resolved
Hide resolved
consensusj-jrpc-echod/src/main/java/org/consensusj/jsonrpc/daemon/EchoJsonRpcService.java
Outdated
Show resolved
Hide resolved
|
@liamgilligan See PR #303 |
4b0f436 to
c6e6377
Compare
c6e6377 to
d7729fa
Compare
msgilligan
left a comment
There was a problem hiding this comment.
A few requested changes...
consensusj-jsonrpc/src/main/java/org/consensusj/jsonrpc/help/JsonRpcHelp.java
Show resolved
Hide resolved
consensusj-jrpc-echod/src/test/java/org/consensusj/jsonrpc/daemon/ApplicationTest.java
Show resolved
Hide resolved
consensusj-jrpc-echod/src/test/java/org/consensusj/jsonrpc/daemon/ApplicationTest.java
Outdated
Show resolved
Hide resolved
consensusj-jsonrpc/src/main/java/org/consensusj/jsonrpc/services/EchoJsonRpcService.java
Show resolved
Hide resolved
3f149c6 to
f57f010
Compare
Added short summary and detailed help text, added and updated tests, and added javadoc and copyright headers when applicable.
f57f010 to
65101e1
Compare
msgilligan
left a comment
There was a problem hiding this comment.
Looks good. I have a few requests.
| @Test | ||
| void helpForHelpMethod() throws IOException { | ||
| var expectedResultSubstring = "Displays detailed help text for the specified method."; | ||
| try (var client = new DefaultRpcClient(endpoint, "", "")) { |
There was a problem hiding this comment.
Use @BeforeEach to initialize client for each test. Use @AfterEach to call client.close(). This will make the individual tests more readable by eliminating the call to DefaultRpcClient and the try block.
| var expectedResultSubstring = "Displays detailed help text for the specified method."; | ||
| try (var client = new DefaultRpcClient(endpoint, "", "")) { | ||
| String result = (String) client.send("help", "help"); | ||
| assertTrue(result.contains(expectedResultSubstring)); |
There was a problem hiding this comment.
For now we don't need to match the entire text of the result, but we should verify that the result contains the method name and the correct argument name (and optional parens) So that's three asserts per test:
- contains method name
- contains parameter names and optionality info
- contains descriptive text
| + "Parameters:\n" | ||
| + " None.\n") | ||
| ); | ||
| private static final String helpString = createHelpString(EchoJsonRpcService::createHelpStringLine); |
There was a problem hiding this comment.
This member should probably be renamed something like allMethodsHelpString or similar and have a JavaDoc comment explaining what it is.
|
|
||
| public CompletableFuture<String> help() { | ||
| /** | ||
| * Get detailed help information for a given command. |
| public CompletableFuture<String> help() { | ||
| /** | ||
| * Get detailed help information for a given command. | ||
| * @param method: A string containing the method name |
There was a problem hiding this comment.
... or null for all commands.
| if (method == null) { | ||
| return result(helpString); | ||
| } | ||
| if (helpMap.containsKey(method)) { |
There was a problem hiding this comment.
I would use an else if here, just to be a little more clear that exactly one of the three conditions will be true.
| } | ||
|
|
||
| /** | ||
| * Create a string containing the name of each method and it's parameters in alphabetical order. |
PR for #260
Currently filler text is being used, tests have been written/modified to account for new
helpbehavior.