diff options
author | William Godbe <wigodbe@microsoft.com> | 2020-09-02 03:37:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-02 03:37:56 +0300 |
commit | b44c6280674d66e29ad8bcb5e8688b04ed96fabe (patch) | |
tree | 1e973b67ab78045a85c69bca38f2ec8dfc41a18f | |
parent | 7527117084c69a39062443e1f2da6ea09c48b9d6 (diff) |
Separate MessagePackHubProtocol into its own package (#25253)
* Separate MessagePackHubProtocol into its own package
* Remove gitignore
* Maybe undo this later
* More factoring
* Get gradle test working
* Get gradle test working
* Get rid of version.java
* Separate build.gradle files for all
* Create separate javaproj's for everything
* Fix warnings
* Resolve conflicts
* Fixup gitignore
* Feedback, fix error
* Fix error
* Change package name
* Fix folder structure
* Skip helix tests, fix .gitignore
* Make TransferFormat private
-rw-r--r-- | src/SignalR/clients/java/signalr/.gitignore | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/build.gradle | 105 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/build.gradle | 75 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/signalr.client.java.core.javaproj | 57 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/.gitignore | 1 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action1.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action1.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action2.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action2.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action3.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action3.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action4.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action4.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action5.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action5.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action6.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action6.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action7.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action7.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action8.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action8.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/ActionBase.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/ActionBase.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CallbackMap.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CallbackMap.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CancelInvocationMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CancelInvocationMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CloseMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CloseMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CompletionMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CompletionMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/DefaultHttpClient.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/DefaultHttpClient.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeProtocol.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeProtocol.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeRequestMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeRequestMessage.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeResponseMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeResponseMessage.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HttpClient.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpClient.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java) | 7 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnection.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnectionBuilder.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnectionBuilder.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnectionState.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnectionState.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubException.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubException.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubMessageType.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubMessageType.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubProtocol.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubProtocol.java) | 4 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationBinder.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationBinder.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationBindingFailureMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationBindingFailureMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationHandler.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationHandler.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationRequest.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationRequest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/JsonHubProtocol.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/JsonHubProtocol.java) | 5 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/LongPollingTransport.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/LongPollingTransport.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Negotiate.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Negotiate.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/NegotiateResponse.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/NegotiateResponse.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OkHttpWebSocketWrapper.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OkHttpWebSocketWrapper.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OnClosedCallback.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OnClosedCallback.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OnReceiveCallBack.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OnReceiveCallBack.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/PingMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/PingMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamBindingFailureMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamBindingFailureMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamInvocationMessage.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamInvocationMessage.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamItem.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamItem.java) | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Subscription.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Subscription.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransferFormat.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransferFormat.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Transport.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Transport.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransportEnum.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransportEnum.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransportOnClosedCallback.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransportOnClosedCallback.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TypeReference.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TypeReference.java) | 1 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/UserAgentHelper.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/UserAgentHelper.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Utils.java | 46 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebSocketTransport.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebSocketTransport.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebSocketWrapper.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebSocketWrapper.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebsocketWrapperOnClosed.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebsocketWrapperOnClosed.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/package-info.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/package-info.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/messagepack/build.gradle | 50 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/messagepack/signalr.client.java.messagepack.javaproj | 57 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/MessagePackHubProtocol.java) | 23 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/Utils.java (renamed from src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Utils.java) | 23 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/settings.gradle | 2 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Version.java | 11 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/build.gradle | 16 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/signalr.client.java.Tests.javaproj (renamed from src/SignalR/clients/java/signalr/signalr.client.java.Tests.javaproj) | 57 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/ByteString.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/ByteString.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HandshakeProtocolTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HandshakeProtocolTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubConnectionBuilderTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionBuilderTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubConnectionTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubExceptionTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubExceptionTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/JsonHubProtocolTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/JsonHubProtocolTest.java) | 5 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/LongPollingTransportTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/LongPollingTransportTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/MessagePackHubProtocolTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/MessagePackHubProtocolTest.java) | 7 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/MockTransport.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/MockTransport.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/NegotiateResponseTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/NegotiateResponseTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/PersonPojo.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/PersonPojo.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/ResolveNegotiateUrlTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/ResolveNegotiateUrlTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestBinder.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestBinder.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestHttpClient.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestHttpClient.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestUtils.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestUtils.java) | 3 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/UserAgentTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/UserAgentTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/WebSocketTransportTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/WebSocketTransportTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/WebSocketTransportUrlFormatTest.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/WebSocketTransportUrlFormatTest.java) | 0 | ||||
-rw-r--r-- | src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/sample/Chat.java (renamed from src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/sample/Chat.java) | 0 |
87 files changed, 373 insertions, 208 deletions
diff --git a/src/SignalR/clients/java/signalr/.gitignore b/src/SignalR/clients/java/signalr/.gitignore index 3e9534ce39..88f14c5caf 100644 --- a/src/SignalR/clients/java/signalr/.gitignore +++ b/src/SignalR/clients/java/signalr/.gitignore @@ -2,7 +2,7 @@ .gradletasknamecache .gradle/ build/ -/test-results +test/test-results .settings/ out/ *.class diff --git a/src/SignalR/clients/java/signalr/build.gradle b/src/SignalR/clients/java/signalr/build.gradle index d559274414..e09780cc60 100644 --- a/src/SignalR/clients/java/signalr/build.gradle +++ b/src/SignalR/clients/java/signalr/build.gradle @@ -15,32 +15,18 @@ plugins { id 'maven' } -apply plugin: "java-library" -apply plugin: "com.diffplug.gradle.spotless" -apply plugin: 'org.junit.platform.gradle.plugin' +allprojects { + apply plugin: "java-library" + apply plugin: "com.diffplug.gradle.spotless" -group 'com.microsoft.signalr' + // If we're run from outside MSBuild, just assign a bogus dev version. + version project.findProperty('packageVersion') ?: "99.99.99-dev" -// If we're run from outside MSBuild, just assign a bogus dev version. -version project.findProperty('packageVersion') ?: "99.99.99-dev" + sourceCompatibility = 1.8 -sourceCompatibility = 1.8 - -repositories { - mavenCentral() -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' - testCompile 'org.junit.jupiter:junit-jupiter-params:5.3.1' - testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.3.1' - testCompile 'org.slf4j:slf4j-jdk14:1.7.25' - implementation 'com.google.code.gson:gson:2.8.5' - implementation 'com.squareup.okhttp3:okhttp:3.11.0' - api 'io.reactivex.rxjava2:rxjava:2.2.3' - implementation 'org.slf4j:slf4j-api:1.7.25' - compile 'org.msgpack:msgpack-core:0.8.20' - compile 'org.msgpack:jackson-dataformat-msgpack:0.8.20' + repositories { + mavenCentral() + } } spotless { @@ -48,7 +34,7 @@ spotless { licenseHeader '// Copyright (c) .NET Foundation. All rights reserved.\n' + '// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n\n' // License header - importOrder 'java', 'javax', 'org', 'com', 'com.diffplug', '' // A sequence of package names + importOrder 'java', 'javax', 'org', 'com', 'com.diffplug', '' // A sequence of package names replace 'Not enough space after if', 'if(', 'if (' replace 'Not enough space after else', 'else{', 'else {' @@ -66,73 +52,4 @@ spotless { indentWithSpaces(4) removeUnusedImports() // removes any unused imports } -} - -junitPlatform { - reportsDir file('test-results') -} - -task sourceJar(type: Jar) { - classifier "sources" - from sourceSets.main.allJava -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier "javadoc" - from javadoc.destinationDir -} - -task generatePOM { - pom { - project { - inceptionYear '2018' - description 'ASP.NET Core SignalR Client for Java applications' - url 'https://github.com/dotnet/aspnetcore' - name groupId + ':' + artifactId - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - scm { - connection 'scm:git:git://github.com/dotnet/aspnetcore.git' - developerConnection 'scm:git:git://github.com/dotnet/aspnetcore.git' - url 'http://github.com/dotnet/aspnetcore/tree/master' - } - developers { - developer { - id 'microsoft' - name 'Microsoft' - } - } - } - }.writeTo("${buildDir}/libs/signalr-${project.version}.pom") -} - -task createPackage(dependsOn: [jar,sourceJar,javadocJar,generatePOM]) - -task generateVersionClass { - inputs.property "version", project.version - outputs.dir "$buildDir/generated" - doFirst { - def versionFile = file("$buildDir/../src/main/java/com/microsoft/signalr/Version.java") - versionFile.parentFile.mkdirs() - versionFile.text = - """ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -package com.microsoft.signalr; - -class Version { - public static String getDetailedVersion() { - return "$project.version"; - } -} -""" - } -} - -compileJava.dependsOn generateVersionClass +}
\ No newline at end of file diff --git a/src/SignalR/clients/java/signalr/core/build.gradle b/src/SignalR/clients/java/signalr/core/build.gradle new file mode 100644 index 0000000000..f7bdcb67e9 --- /dev/null +++ b/src/SignalR/clients/java/signalr/core/build.gradle @@ -0,0 +1,75 @@ +group 'com.microsoft.signalr' + +dependencies { + implementation 'com.google.code.gson:gson:2.8.5' + implementation 'com.squareup.okhttp3:okhttp:3.11.0' + api 'io.reactivex.rxjava2:rxjava:2.2.3' + implementation 'org.slf4j:slf4j-api:1.7.25' +} + +archivesBaseName = 'signalr' + +task sourceJar(type: Jar) { + classifier "sources" + from sourceSets.main.allJava +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier "javadoc" + from javadoc.destinationDir +} + +task generatePOM { + pom { + project { + inceptionYear '2018' + description 'ASP.NET Core SignalR Client for Java applications' + url 'https://github.com/dotnet/aspnetcore' + name groupId + ':' + artifactId + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + scm { + connection 'scm:git:git://github.com/dotnet/aspnetcore.git' + developerConnection 'scm:git:git://github.com/dotnet/aspnetcore.git' + url 'http://github.com/dotnet/aspnetcore/tree/master' + } + developers { + developer { + id 'microsoft' + name 'Microsoft' + } + } + } + }.writeTo("${buildDir}/libs/signalr-${project.version}.pom") +} + +task createPackage(dependsOn: [jar,sourceJar,javadocJar,generatePOM]) + +task generateVersionClass { + inputs.property "version", project.version + outputs.dir "$buildDir/generated" + doFirst { + def versionFile = file("$buildDir/../src/main/java/com/microsoft/signalr/Version.java") + versionFile.parentFile.mkdirs() + versionFile.text = + """ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +package com.microsoft.signalr; + +class Version { + public static String getDetailedVersion() { + return "$project.version"; + } +} +""" + } +} + +compileJava.dependsOn generateVersionClass
\ No newline at end of file diff --git a/src/SignalR/clients/java/signalr/core/signalr.client.java.core.javaproj b/src/SignalR/clients/java/signalr/core/signalr.client.java.core.javaproj new file mode 100644 index 0000000000..2bc876ea0c --- /dev/null +++ b/src/SignalR/clients/java/signalr/core/signalr.client.java.core.javaproj @@ -0,0 +1,57 @@ +<Project> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" /> + + <PropertyGroup> + <!-- This package ID is only ever used along with eng/PatchConfig.props to determine when to patch the Java client. --> + <PackageId>java:signalr</PackageId> + <!-- In servicing builds, this will be set to value if the Java client is not configured to be released in the currently building patch. --> + <IsPackable>true</IsPackable> + <IsTestProject>false</IsTestProject> + <!-- Disable gradle daemon on CI since the CI seems to try to wait for the daemon to shut down, which it doesn't do :) --> + <GradleOptions Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(GradleOptions) -Dorg.gradle.daemon=false</GradleOptions> + <PublishDir>$(OutputPath)</PublishDir> + </PropertyGroup> + + <ItemGroup> + <Jars Include=" + signalr-$(PackageVersion).jar; + signalr-$(PackageVersion)-javadoc.jar; + signalr-$(PackageVersion)-sources.jar;" /> + <PomFile Include="signalr-$(PackageVersion).pom" /> + <JavaBuildFiles Include="@(Jars);@(PomFile)"/> + </ItemGroup> + + <Target Name="Restore" /> + + <PropertyGroup> + <PackDependsOn Condition=" '$(NoBuild)' != 'true' "> + $(PackDependsOn); + Build + </PackDependsOn> + </PropertyGroup> + + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> + + <PropertyGroup> + <GradleOptions>$(GradleOptions) -PpackageVersion="$(PackageVersion)"</GradleOptions> + </PropertyGroup> + + <!-- Define Target overrides after importing Directory.Build.targets so these don't get overridden --> + <Target Name="Pack" DependsOnTargets="$(PackDependsOn)" Condition="'$(IsPackable)' == 'true'"> + <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Pack" /> + <Message Text="> gradlew $(GradleOptions) createPackage" Importance="high" /> + <Exec Command="../gradlew $(GradleOptions) createPackage" /> + <Message Importance="high" Text="java:signalr -> $(PackageOutputPath)%(JavaBuildFiles.Identity)" /> + <Copy SourceFiles="$(MSBuildThisFileDirectory)build\libs\%(JavaBuildFiles.Identity)" DestinationFolder="$(PackageOutputPath)" /> + </Target> + + <Target Name="Build"> + <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Build" /> + <Exec Command="../gradlew $(GradleOptions) compileJava" /> + </Target> + + <Target Name="Test" /> + + <Target Name="Publish" /> + +</Project> diff --git a/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/.gitignore b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/.gitignore new file mode 100644 index 0000000000..b74fd93836 --- /dev/null +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/.gitignore @@ -0,0 +1 @@ +Version.java
\ No newline at end of file diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action.java index d1d8172916..d1d8172916 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action1.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action1.java index 3943b7026c..3943b7026c 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action1.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action1.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action2.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action2.java index bd0a366118..bd0a366118 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action2.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action2.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action3.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action3.java index c1d0fb39ca..c1d0fb39ca 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action3.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action3.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action4.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action4.java index 48430b05fc..48430b05fc 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action4.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action4.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action5.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action5.java index 03bd0f8120..03bd0f8120 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action5.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action5.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action6.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action6.java index fc1b166b4a..fc1b166b4a 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action6.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action6.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action7.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action7.java index 3aa510baf3..3aa510baf3 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action7.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action7.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action8.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action8.java index 351656d3d9..351656d3d9 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Action8.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Action8.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/ActionBase.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/ActionBase.java index 63631da4f7..63631da4f7 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/ActionBase.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/ActionBase.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CallbackMap.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CallbackMap.java index 5bb317cd1f..5bb317cd1f 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CallbackMap.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CallbackMap.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CancelInvocationMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CancelInvocationMessage.java index 9f375aea72..ce5d76f4b7 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CancelInvocationMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CancelInvocationMessage.java @@ -5,7 +5,7 @@ package com.microsoft.signalr; import java.util.Map; -final class CancelInvocationMessage extends HubMessage { +public final class CancelInvocationMessage extends HubMessage { private final int type = HubMessageType.CANCEL_INVOCATION.value; private Map<String, String> headers; private final String invocationId; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CloseMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CloseMessage.java index 1d89695057..3486949aac 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CloseMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CloseMessage.java @@ -3,7 +3,7 @@ package com.microsoft.signalr; -final class CloseMessage extends HubMessage { +public final class CloseMessage extends HubMessage { private final String error; private final boolean allowReconnect; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CompletionMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CompletionMessage.java index 7256c7dfd4..e581a636ac 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/CompletionMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/CompletionMessage.java @@ -5,7 +5,7 @@ package com.microsoft.signalr; import java.util.Map; -final class CompletionMessage extends HubMessage { +public final class CompletionMessage extends HubMessage { private final int type = HubMessageType.COMPLETION.value; private Map<String, String> headers; private final String invocationId; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/DefaultHttpClient.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/DefaultHttpClient.java index f8ddc42c6b..f8ddc42c6b 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/DefaultHttpClient.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/DefaultHttpClient.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeProtocol.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeProtocol.java index c7df51fd03..c7df51fd03 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeProtocol.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeProtocol.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeRequestMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeRequestMessage.java index b7f4754d18..b7f4754d18 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeRequestMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeRequestMessage.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeResponseMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeResponseMessage.java index 06e0dc1d01..06e0dc1d01 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HandshakeResponseMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HandshakeResponseMessage.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpClient.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HttpClient.java index 9a5ecf352b..9a5ecf352b 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpClient.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HttpClient.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java index ce29e1a2ce..24722eba17 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java @@ -57,12 +57,13 @@ public class HttpHubConnectionBuilder { } /** - * Sets MessagePack as the {@link HubProtocol} to be used by the {@link HubConnection}. + * Sets the {@link HubProtocol} to be used by the {@link HubConnection}. * + * @param protocol The {@link HubProtocol} to be used by the {@link HubConnection}. * @return This instance of the HttpHubConnectionBuilder. */ - public HttpHubConnectionBuilder withMessagePackHubProtocol() { - this.protocol = new MessagePackHubProtocol(); + public HttpHubConnectionBuilder withHubProtocol(HubProtocol protocol) { + this.protocol = protocol; return this; } diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnection.java index 0aa4e4c336..0aa4e4c336 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnection.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnectionBuilder.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnectionBuilder.java index dcba7bd0f3..dcba7bd0f3 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnectionBuilder.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnectionBuilder.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnectionState.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnectionState.java index d3fc796ee4..d3fc796ee4 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnectionState.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubConnectionState.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubException.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubException.java index 189b222182..189b222182 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubException.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubException.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubMessage.java index ff9e50747a..c4192bf128 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubMessage.java @@ -6,6 +6,6 @@ package com.microsoft.signalr; /** * A base class for hub messages. */ - abstract class HubMessage { +public abstract class HubMessage { public abstract HubMessageType getMessageType(); } diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubMessageType.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubMessageType.java index a1bfeebfcf..805f9c9c4e 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubMessageType.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubMessageType.java @@ -3,7 +3,7 @@ package com.microsoft.signalr; -enum HubMessageType { +public enum HubMessageType { INVOCATION(1), STREAM_ITEM(2), COMPLETION(3), diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubProtocol.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubProtocol.java index 844a458c8c..42471a45e1 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubProtocol.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/HubProtocol.java @@ -9,14 +9,14 @@ import java.util.List; /** * A protocol abstraction for communicating with SignalR hubs. */ -interface HubProtocol { +public interface HubProtocol { String getName(); int getVersion(); - TransferFormat getTransferFormat(); /** * Creates a new list of {@link HubMessage}s. * @param message A ByteBuffer representation of one or more {@link HubMessage}s. + * @param binder The {@link InvocationBinder} to use for this Protocol instance. * @return A list of {@link HubMessage}s. */ List<HubMessage> parseMessages(ByteBuffer message, InvocationBinder binder); diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationBinder.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationBinder.java index 40767a7a98..f09035f4f9 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationBinder.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationBinder.java @@ -9,7 +9,7 @@ import java.util.List; /** * An abstraction for passing around information about method signatures. */ -interface InvocationBinder { +public interface InvocationBinder { Type getReturnType(String invocationId); List<Type> getParameterTypes(String methodName); }
\ No newline at end of file diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationBindingFailureMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationBindingFailureMessage.java index cda90f9c94..f87c0b2cd1 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationBindingFailureMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationBindingFailureMessage.java @@ -3,7 +3,7 @@ package com.microsoft.signalr; -class InvocationBindingFailureMessage extends HubMessage { +public class InvocationBindingFailureMessage extends HubMessage { private final String invocationId; private final String target; private final Exception exception; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationHandler.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationHandler.java index 0ee7b745e9..0ee7b745e9 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationHandler.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationHandler.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationMessage.java index ecc3650ffe..7820fb4ffc 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationMessage.java @@ -6,7 +6,7 @@ package com.microsoft.signalr; import java.util.Collection; import java.util.Map; -class InvocationMessage extends HubMessage { +public class InvocationMessage extends HubMessage { int type = HubMessageType.INVOCATION.value; private Map<String, String> headers; private final String invocationId; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationRequest.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationRequest.java index 7c57d6177c..7c57d6177c 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/InvocationRequest.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/InvocationRequest.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/JsonHubProtocol.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/JsonHubProtocol.java index 892f600ea7..bd0348442e 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/JsonHubProtocol.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/JsonHubProtocol.java @@ -35,11 +35,6 @@ class JsonHubProtocol implements HubProtocol { } @Override - public TransferFormat getTransferFormat() { - return TransferFormat.TEXT; - } - - @Override public List<HubMessage> parseMessages(ByteBuffer payload, InvocationBinder binder) { String payloadStr; // If the payload is readOnly, we have to copy the bytes from its array to make the payload string diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/LongPollingTransport.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/LongPollingTransport.java index 00dc46f97b..00dc46f97b 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/LongPollingTransport.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/LongPollingTransport.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Negotiate.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Negotiate.java index 73dc0ddf64..73dc0ddf64 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Negotiate.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Negotiate.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/NegotiateResponse.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/NegotiateResponse.java index bf09b37578..bf09b37578 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/NegotiateResponse.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/NegotiateResponse.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OkHttpWebSocketWrapper.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OkHttpWebSocketWrapper.java index ae27363720..ae27363720 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OkHttpWebSocketWrapper.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OkHttpWebSocketWrapper.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OnClosedCallback.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OnClosedCallback.java index 0122b0d869..0122b0d869 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OnClosedCallback.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OnClosedCallback.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OnReceiveCallBack.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OnReceiveCallBack.java index 4dde220440..4dde220440 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/OnReceiveCallBack.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/OnReceiveCallBack.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/PingMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/PingMessage.java index 1c0286f70e..4efb26e21b 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/PingMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/PingMessage.java @@ -3,7 +3,7 @@ package com.microsoft.signalr; -class PingMessage extends HubMessage +public class PingMessage extends HubMessage { private final int type = HubMessageType.PING.value; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamBindingFailureMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamBindingFailureMessage.java index d7b145fa3f..dbd6c3cd91 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamBindingFailureMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamBindingFailureMessage.java @@ -3,7 +3,7 @@ package com.microsoft.signalr; -class StreamBindingFailureMessage extends HubMessage { +public class StreamBindingFailureMessage extends HubMessage { private final String invocationId; private final Exception exception; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamInvocationMessage.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamInvocationMessage.java index 0a8c6211b6..414adaf942 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamInvocationMessage.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamInvocationMessage.java @@ -6,7 +6,7 @@ package com.microsoft.signalr; import java.util.Collection; import java.util.Map; -final class StreamInvocationMessage extends InvocationMessage { +public final class StreamInvocationMessage extends InvocationMessage { public StreamInvocationMessage(Map<String, String> headers, String invocationId, String target, Object[] args, Collection<String> streamIds) { super(headers, invocationId, target, args, streamIds); diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamItem.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamItem.java index 9b18f0bdc3..26dfc7f8e2 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/StreamItem.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/StreamItem.java @@ -5,7 +5,7 @@ package com.microsoft.signalr; import java.util.Map; -final class StreamItem extends HubMessage { +public final class StreamItem extends HubMessage { private final int type = HubMessageType.STREAM_ITEM.value; private Map<String, String> headers; private final String invocationId; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Subscription.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Subscription.java index 07f39b7d62..07f39b7d62 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Subscription.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Subscription.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransferFormat.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransferFormat.java index 59a9dd5889..59a9dd5889 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransferFormat.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransferFormat.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Transport.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Transport.java index ab0d547898..ab0d547898 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Transport.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Transport.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransportEnum.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransportEnum.java index 6c3af5db11..6c3af5db11 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransportEnum.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransportEnum.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransportOnClosedCallback.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransportOnClosedCallback.java index d06f00dd98..d06f00dd98 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TransportOnClosedCallback.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TransportOnClosedCallback.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TypeReference.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TypeReference.java index 9fad029eec..24213e663b 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/TypeReference.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/TypeReference.java @@ -31,6 +31,7 @@ public class TypeReference<T> { /** * Gets the referenced type. + * @return The Type encapsulated by this TypeReference */ public Type getType() { return this.type; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/UserAgentHelper.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/UserAgentHelper.java index 977797af5f..977797af5f 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/UserAgentHelper.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/UserAgentHelper.java diff --git a/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Utils.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Utils.java new file mode 100644 index 0000000000..45fc99d32f --- /dev/null +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Utils.java @@ -0,0 +1,46 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +package com.microsoft.signalr; + +import java.io.IOException; +import java.lang.reflect.Array; +import java.lang.reflect.GenericArrayType; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.lang.reflect.WildcardType; +import java.nio.ByteBuffer; +import java.util.ArrayList; + +class Utils { + public static String appendQueryString(String original, String queryStringValue) { + if (original.contains("?")) { + return original + "&" + queryStringValue; + } else { + return original + "?" + queryStringValue; + } + } + + public static Class<?> typeToClass(Type type) { + if (type == null) { + return null; + } + if (type instanceof Class) { + return (Class<?>) type; + } else if (type instanceof GenericArrayType) { + // Instantiate an array of the same type as this type, then return its class + return Array.newInstance(typeToClass(((GenericArrayType)type).getGenericComponentType()), 0).getClass(); + } else if (type instanceof ParameterizedType) { + return typeToClass(((ParameterizedType) type).getRawType()); + } else if (type instanceof TypeVariable) { + Type[] bounds = ((TypeVariable<?>) type).getBounds(); + return bounds.length == 0 ? Object.class : typeToClass(bounds[0]); + } else if (type instanceof WildcardType) { + Type[] bounds = ((WildcardType) type).getUpperBounds(); + return bounds.length == 0 ? Object.class : typeToClass(bounds[0]); + } else { + throw new UnsupportedOperationException("Cannot handle type class: " + type.getClass()); + } + } +}
\ No newline at end of file diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebSocketTransport.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebSocketTransport.java index 42ef00231f..42ef00231f 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebSocketTransport.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebSocketTransport.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebSocketWrapper.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebSocketWrapper.java index 773f40ab0e..773f40ab0e 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebSocketWrapper.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebSocketWrapper.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebsocketWrapperOnClosed.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebsocketWrapperOnClosed.java index 055ced74cc..055ced74cc 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/WebsocketWrapperOnClosed.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/WebsocketWrapperOnClosed.java diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/package-info.java b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/package-info.java index 500cc9d4d1..500cc9d4d1 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/package-info.java +++ b/src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/package-info.java diff --git a/src/SignalR/clients/java/signalr/messagepack/build.gradle b/src/SignalR/clients/java/signalr/messagepack/build.gradle new file mode 100644 index 0000000000..7d4d979c11 --- /dev/null +++ b/src/SignalR/clients/java/signalr/messagepack/build.gradle @@ -0,0 +1,50 @@ +group 'com.microsoft.signalr.messagepack' + +dependencies { + implementation project(':core') + compile 'org.msgpack:msgpack-core:0.8.20' + compile 'org.msgpack:jackson-dataformat-msgpack:0.8.20' +} + +archivesBaseName = 'signalr-messagepack' + +task sourceJar(type: Jar) { + classifier "sources" + from sourceSets.main.allJava +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier "javadoc" + from javadoc.destinationDir +} + +task generatePOM { + pom { + project { + inceptionYear '2020' + description 'MessagePack protocol implementation for ASP.NET Core SignalR Client for Java applications' + url 'https://github.com/dotnet/aspnetcore' + name groupId + ':' + artifactId + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + scm { + connection 'scm:git:git://github.com/dotnet/aspnetcore.git' + developerConnection 'scm:git:git://github.com/dotnet/aspnetcore.git' + url 'http://github.com/dotnet/aspnetcore/tree/master' + } + developers { + developer { + id 'microsoft' + name 'Microsoft' + } + } + } + }.writeTo("${buildDir}/libs/signalr-messagepack-${project.version}.pom") +} + +task createPackage(dependsOn: [jar,sourceJar,javadocJar,generatePOM])
\ No newline at end of file diff --git a/src/SignalR/clients/java/signalr/messagepack/signalr.client.java.messagepack.javaproj b/src/SignalR/clients/java/signalr/messagepack/signalr.client.java.messagepack.javaproj new file mode 100644 index 0000000000..37e14879af --- /dev/null +++ b/src/SignalR/clients/java/signalr/messagepack/signalr.client.java.messagepack.javaproj @@ -0,0 +1,57 @@ +<Project> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" /> + + <PropertyGroup> + <!-- This package ID is only ever used along with eng/PatchConfig.props to determine when to patch the Java client. --> + <PackageId>java:signalr-messagepack</PackageId> + <!-- In servicing builds, this will be set to value if the Java client is not configured to be released in the currently building patch. --> + <IsPackable>true</IsPackable> + <IsTestProject>false</IsTestProject> + <!-- Disable gradle daemon on CI since the CI seems to try to wait for the daemon to shut down, which it doesn't do :) --> + <GradleOptions Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(GradleOptions) -Dorg.gradle.daemon=false</GradleOptions> + <PublishDir>$(OutputPath)</PublishDir> + </PropertyGroup> + + <ItemGroup> + <Jars Include=" + signalr-messagepack-$(PackageVersion).jar; + signalr-messagepack-$(PackageVersion)-javadoc.jar; + signalr-messagepack-$(PackageVersion)-sources.jar;" /> + <PomFile Include="signalr-messagepack-$(PackageVersion).pom" /> + <JavaBuildFiles Include="@(Jars);@(PomFile)"/> + </ItemGroup> + + <Target Name="Restore" /> + + <PropertyGroup> + <PackDependsOn Condition=" '$(NoBuild)' != 'true' "> + $(PackDependsOn); + Build + </PackDependsOn> + </PropertyGroup> + + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> + + <PropertyGroup> + <GradleOptions>$(GradleOptions) -PpackageVersion="$(PackageVersion)"</GradleOptions> + </PropertyGroup> + + <!-- Define Target overrides after importing Directory.Build.targets so these don't get overridden --> + <Target Name="Pack" DependsOnTargets="$(PackDependsOn)" Condition="'$(IsPackable)' == 'true'"> + <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Pack" /> + <Message Text="> gradlew $(GradleOptions) createPackage" Importance="high" /> + <Exec Command="../gradlew $(GradleOptions) createPackage" /> + <Message Importance="high" Text="java:signalr-messagepack -> $(PackageOutputPath)%(JavaBuildFiles.Identity)" /> + <Copy SourceFiles="$(MSBuildThisFileDirectory)build\libs\%(JavaBuildFiles.Identity)" DestinationFolder="$(PackageOutputPath)" /> + </Target> + + <Target Name="Build"> + <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Build" /> + <Exec Command="../gradlew $(GradleOptions) compileJava" /> + </Target> + + <Target Name="Test" /> + + <Target Name="Publish" /> + +</Project> diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/MessagePackHubProtocol.java b/src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java index bd7f9cd7b2..ebd2047331 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/MessagePackHubProtocol.java +++ b/src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -package com.microsoft.signalr; +package com.microsoft.signalr.messagepack; import java.io.IOException; import java.lang.reflect.Type; @@ -25,7 +25,21 @@ import org.msgpack.value.ValueType; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; -class MessagePackHubProtocol implements HubProtocol { +import com.microsoft.signalr.CancelInvocationMessage; +import com.microsoft.signalr.CloseMessage; +import com.microsoft.signalr.CompletionMessage; +import com.microsoft.signalr.HubMessage; +import com.microsoft.signalr.HubMessageType; +import com.microsoft.signalr.HubProtocol; +import com.microsoft.signalr.InvocationBinder; +import com.microsoft.signalr.InvocationBindingFailureMessage; +import com.microsoft.signalr.InvocationMessage; +import com.microsoft.signalr.PingMessage; +import com.microsoft.signalr.StreamBindingFailureMessage; +import com.microsoft.signalr.StreamInvocationMessage; +import com.microsoft.signalr.StreamItem; + +public class MessagePackHubProtocol implements HubProtocol { private static final int ERROR_RESULT = 1; private static final int VOID_RESULT = 2; @@ -45,11 +59,6 @@ class MessagePackHubProtocol implements HubProtocol { } @Override - public TransferFormat getTransferFormat() { - return TransferFormat.BINARY; - } - - @Override public List<HubMessage> parseMessages(ByteBuffer payload, InvocationBinder binder) { if (payload.remaining() == 0) { return null; diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Utils.java b/src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/Utils.java index 88d589a936..4eba17b6fc 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Utils.java +++ b/src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/Utils.java @@ -1,7 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -package com.microsoft.signalr; +package com.microsoft.signalr.messagepack; import java.io.IOException; import java.lang.reflect.Array; @@ -14,14 +11,6 @@ import java.nio.ByteBuffer; import java.util.ArrayList; class Utils { - public static String appendQueryString(String original, String queryStringValue) { - if (original.contains("?")) { - return original + "&" + queryStringValue; - } else { - return original + "?" + queryStringValue; - } - } - public static int readLengthHeader(ByteBuffer buffer) throws IOException { // The payload starts with a length prefix encoded as a VarInt. VarInts use the most significant bit // as a marker whether the byte is the last byte of the VarInt or if it spans to the next byte. Bytes @@ -89,9 +78,9 @@ class Utils { } public static Class<?> typeToClass(Type type) { - if (type == null) { - return null; - } + if (type == null) { + return null; + } if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof GenericArrayType) { @@ -108,5 +97,5 @@ class Utils { } else { throw new UnsupportedOperationException("Cannot handle type class: " + type.getClass()); } - } -}
\ No newline at end of file + } +} diff --git a/src/SignalR/clients/java/signalr/settings.gradle b/src/SignalR/clients/java/signalr/settings.gradle index 80beacb801..a82ab27def 100644 --- a/src/SignalR/clients/java/signalr/settings.gradle +++ b/src/SignalR/clients/java/signalr/settings.gradle @@ -1,2 +1,2 @@ rootProject.name = 'signalr' -include 'main' +include 'core', 'messagepack', 'test' diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Version.java b/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Version.java deleted file mode 100644 index 3877f515be..0000000000 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/Version.java +++ /dev/null @@ -1,11 +0,0 @@ - -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -package com.microsoft.signalr; - -class Version { - public static String getDetailedVersion() { - return "5.0.0-dev"; - } -} diff --git a/src/SignalR/clients/java/signalr/test/build.gradle b/src/SignalR/clients/java/signalr/test/build.gradle new file mode 100644 index 0000000000..75a451b929 --- /dev/null +++ b/src/SignalR/clients/java/signalr/test/build.gradle @@ -0,0 +1,16 @@ +apply plugin: 'org.junit.platform.gradle.plugin' + +dependencies { + implementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' + compile 'org.junit.jupiter:junit-jupiter-params:5.3.1' + runtime 'org.junit.jupiter:junit-jupiter-engine:5.3.1' + implementation 'com.google.code.gson:gson:2.8.5' + testCompile 'org.slf4j:slf4j-jdk14:1.7.25' + implementation project(':core') + implementation project(':messagepack') + compile project(':messagepack') +} + +junitPlatform { + reportsDir file('test-results') +}
\ No newline at end of file diff --git a/src/SignalR/clients/java/signalr/signalr.client.java.Tests.javaproj b/src/SignalR/clients/java/signalr/test/signalr.client.java.Tests.javaproj index 84771b3fe4..d44d8d25a0 100644 --- a/src/SignalR/clients/java/signalr/signalr.client.java.Tests.javaproj +++ b/src/SignalR/clients/java/signalr/test/signalr.client.java.Tests.javaproj @@ -2,75 +2,44 @@ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" /> <PropertyGroup> - - <!-- This package ID is only ever used along with eng/PatchConfig.props to determine when to patch the Java client. --> - <PackageId>java:signalr</PackageId> - - <!-- In servicing builds, this will be set to value if the Java client is not configured to be released in the currently building patch. --> - <IsPackable>true</IsPackable> - + <IsPackable>false</IsPackable> <IsTestProject>true</IsTestProject> - <!-- Installing Java on ARM will take some work --> <SkipHelixArm>true</SkipHelixArm> - + <!-- Skipping on Helix for now --> + <BuildHelixPayload>false</BuildHelixPayload> <!-- Disable gradle daemon on CI since the CI seems to try to wait for the daemon to shut down, which it doesn't do :) --> <GradleOptions Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(GradleOptions) -Dorg.gradle.daemon=false</GradleOptions> <PublishDir>$(OutputPath)</PublishDir> <TestDependsOnJava>true</TestDependsOnJava> - </PropertyGroup> - <ItemGroup> - <Jars Include=" - signalr-$(PackageVersion).jar; - signalr-$(PackageVersion)-javadoc.jar; - signalr-$(PackageVersion)-sources.jar;" /> - <PomFile Include="signalr-$(PackageVersion).pom" /> - <JavaBuildFiles Include="@(Jars);@(PomFile)"/> - </ItemGroup> - <Target Name="Restore" /> - <PropertyGroup> - <PackDependsOn Condition=" '$(NoBuild)' != 'true' "> - $(PackDependsOn); - Build - </PackDependsOn> - </PropertyGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> <!-- Define Target overrides after importing Directory.Build.targets so these don't get overridden --> - <Target Name="Pack" DependsOnTargets="$(PackDependsOn)" Condition="'$(IsPackable)' == 'true'"> - <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Pack" /> - <Message Text="> gradlew $(GradleOptions) createPackage" Importance="high" /> - <Exec Command="./gradlew $(GradleOptions) createPackage" /> - <Message Importance="high" Text="java:signalr -> $(PackageOutputPath)%(JavaBuildFiles.Identity)" /> - <Copy SourceFiles="build\libs\%(JavaBuildFiles.Identity)" DestinationFolder="$(PackageOutputPath)" /> - </Target> + <Target Name="Pack" /> - <Target Name="Build"> - <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Build" /> - <Exec Command="./gradlew $(GradleOptions) compileJava" /> - </Target> + <Target Name="Build" /> <Target Name="Test" Condition="'$(SkipTests)' != 'true'"> <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" /> <Message Text="Running Java client tests" Importance="high" /> <Message Text="> gradlew $(GradleOptions) test" Importance="high" /> - <Exec Command="./gradlew $(GradleOptions) test" IgnoreStandardErrorWarningFormat="true" /> + <Exec Command="../gradlew $(GradleOptions) test" IgnoreStandardErrorWarningFormat="true" /> </Target> <Target Name="Publish"> <ItemGroup> - <Files Include="**/*.java" /> - <Files Include="**/gradle-wrapper.jar" /> - <Files Include="**/gradle-wrapper.properties" /> - <Files Include="gradlew" /> + <Files Include="../**/*.java" /> + <Files Include="../**/gradle-wrapper.jar" /> + <Files Include="../**/gradle-wrapper.properties" /> + <Files Include="../gradlew" /> <Files Include="build.gradle" /> - <Files Include="gradlew.bat" /> - <Files Include="settings.gradle" /> + <Files Include="../build.gradle" /> + <Files Include="../gradlew.bat" /> + <Files Include="../settings.gradle" /> <Files Include="@(Content)" /> </ItemGroup> <Copy DestinationFiles="@(Files->'$(PublishDir)\%(RecursiveDir)%(FileName)%(Extension)')" SourceFiles="@(Files)" /> diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/ByteString.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/ByteString.java index 2546d92454..2546d92454 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/ByteString.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/ByteString.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HandshakeProtocolTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HandshakeProtocolTest.java index e98b55ba01..e98b55ba01 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HandshakeProtocolTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HandshakeProtocolTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionBuilderTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubConnectionBuilderTest.java index c5192c3ef8..c5192c3ef8 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionBuilderTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubConnectionBuilderTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubConnectionTest.java index 402a21c74b..402a21c74b 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubConnectionTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubExceptionTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubExceptionTest.java index 5ab2ed526b..5ab2ed526b 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubExceptionTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/HubExceptionTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/JsonHubProtocolTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/JsonHubProtocolTest.java index 1b707d6a53..c77fa15093 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/JsonHubProtocolTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/JsonHubProtocolTest.java @@ -27,11 +27,6 @@ class JsonHubProtocolTest { } @Test - public void checkTransferFormat() { - assertEquals(TransferFormat.TEXT, jsonHubProtocol.getTransferFormat()); - } - - @Test public void verifyWriteMessage() { InvocationMessage invocationMessage = new InvocationMessage(null, null, "test", new Object[] {"42"}, null); String result = TestUtils.byteBufferToString(jsonHubProtocol.writeMessage(invocationMessage)); diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/LongPollingTransportTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/LongPollingTransportTest.java index 0e65390d39..0e65390d39 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/LongPollingTransportTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/LongPollingTransportTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/MessagePackHubProtocolTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/MessagePackHubProtocolTest.java index 37df89fabf..ad8cca19fc 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/MessagePackHubProtocolTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/MessagePackHubProtocolTest.java @@ -19,6 +19,8 @@ import java.util.TreeMap; import org.junit.jupiter.api.Test; +import com.microsoft.signalr.messagepack.MessagePackHubProtocol; + class MessagePackHubProtocolTest { private MessagePackHubProtocol messagePackHubProtocol = new MessagePackHubProtocol(); @@ -31,11 +33,6 @@ class MessagePackHubProtocolTest { public void checkVersionNumber() { assertEquals(1, messagePackHubProtocol.getVersion()); } - - @Test - public void checkTransferFormat() { - assertEquals(TransferFormat.BINARY, messagePackHubProtocol.getTransferFormat()); - } @Test public void verifyWriteInvocationMessage() { diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/MockTransport.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/MockTransport.java index 919ba49e74..919ba49e74 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/MockTransport.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/MockTransport.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/NegotiateResponseTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/NegotiateResponseTest.java index 1eaa0a00df..1eaa0a00df 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/NegotiateResponseTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/NegotiateResponseTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/PersonPojo.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/PersonPojo.java index 4469773512..4469773512 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/PersonPojo.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/PersonPojo.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/ResolveNegotiateUrlTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/ResolveNegotiateUrlTest.java index 1c2a213f6e..1c2a213f6e 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/ResolveNegotiateUrlTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/ResolveNegotiateUrlTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestBinder.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestBinder.java index b27ebb4154..b27ebb4154 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestBinder.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestBinder.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestHttpClient.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestHttpClient.java index b257076e91..b257076e91 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestHttpClient.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestHttpClient.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestUtils.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestUtils.java index 29b0870988..bf6f7e0b61 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/TestUtils.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/TestUtils.java @@ -5,6 +5,7 @@ package com.microsoft.signalr; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; +import com.microsoft.signalr.messagepack.MessagePackHubProtocol; class TestUtils { @@ -33,7 +34,7 @@ class TestUtils { .shouldSkipNegotiate(skipNegotiate); if (withMessagePack) { - builder = builder.withMessagePackHubProtocol(); + builder = builder.withHubProtocol(new MessagePackHubProtocol()); } return builder.build(); diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/UserAgentTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/UserAgentTest.java index 1a4256897c..1a4256897c 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/UserAgentTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/UserAgentTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/WebSocketTransportTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/WebSocketTransportTest.java index 62ec1e95d7..62ec1e95d7 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/WebSocketTransportTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/WebSocketTransportTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/WebSocketTransportUrlFormatTest.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/WebSocketTransportUrlFormatTest.java index 613ffab959..613ffab959 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/WebSocketTransportUrlFormatTest.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/WebSocketTransportUrlFormatTest.java diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/sample/Chat.java b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/sample/Chat.java index 7a7ab4b8de..7a7ab4b8de 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/sample/Chat.java +++ b/src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/sample/Chat.java |