Open leftiness opened 3 years ago
Work in progress.
[brandon@localhost cometd-client]$ ./gradlew run --quiet --args='s /test'
/test
Working on BayeuxClient things.
notes
links
Making progress.
[brandon@localhost cometd-client]$ ./gradlew run --quiet --args='subscribe http://localhost:8080/cometd /chat/**'
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
{chat=brandon has joined, membership=join, user=brandon}
{chat=hello, user=brandon}
{chat=goodbye, user=brandon}
{chat=brandon has left, membership=leave, user=brandon}
<==========---> 80% EXECUTING [16s]
> :app:run
[brandon@localhost cometd-client]$ ./gradlew run --quiet --args='subscribe http://localhost:8080/cometd /chat/**'
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
DEAD
ESTABLISHED
ALIVE
ALIVE
LOST
DEAD
DEAD
DEAD
DEAD
{chat=asdf has joined, membership=join, user=asdf}
ESTABLISHED
ALIVE
ALIVE
ALIVE
Doesn't make sense to add a listener to log connection status. It's already there in debug logs.
[brandon@localhost cometd-client]$ ./gradlew run -P logLevel=debug --quiet --args='subscribe http://localhost:8080/cometd /chat/**' 2>&1 | grep 'State updated'
[main] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: DISCONNECTED -> HANDSHAKING
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: HANDSHAKING -> HANDSHAKEN
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: HANDSHAKEN -> CONNECTING
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: CONNECTING -> CONNECTED
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: CONNECTED -> CONNECTED
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: CONNECTED -> UNCONNECTED
[pool-1-thread-1] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: UNCONNECTED -> UNCONNECTED
[pool-1-thread-1] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: UNCONNECTED -> UNCONNECTED
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: UNCONNECTED -> REHANDSHAKING
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: REHANDSHAKING -> HANDSHAKEN
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: HANDSHAKEN -> CONNECTING
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.437da279 - State updated: CONNECTING -> CONNECTED
Don't use a Gradle project property. Use java -D
.
[brandon@localhost cometd-client]$ JAVA_OPTS='-Dorg.slf4j.simpleLogger.defaultLogLevel=debug' ./app/build/distributions/app/bin/app subscribe http://localhost:8080/cometd /chat/**/ 2>&1 | grep 'State updated'
[main] DEBUG org.cometd.client.BayeuxClient.1725dc0f - State updated: DISCONNECTED -> HANDSHAKING
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.1725dc0f - State updated: HANDSHAKING -> HANDSHAKEN
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.1725dc0f - State updated: HANDSHAKEN -> CONNECTING
[OkHttp http://localhost:8080/...] DEBUG org.cometd.client.BayeuxClient.1725dc0f - State updated: CONNECTING -> CONNECTED
Now I have tests for SubscribeCommand. Kind of repetitive. Maybe I want to use parameterized tests, but I need to figure out Java modules.
[brandon@localhost cometd-client]$ ./gradlew test
> Configure project :app
Project :app => 'cometd.client' Java module
BUILD SUCCESSFUL in 408ms
3 actionable tasks: 3 up-to-date
todo
mycli
with no options launches hello world GUImycli subscribe [channel]
subscribes to a CometD server and prints events on stdout. Save authentication for later if possible.mycli help
prints CLI usage. Or something similar like --help.notes
links