Making all the things Package Private in the Java Client (#2945)
This commit is contained in:
parent
bfae012dd0
commit
9db1c2af1a
|
|
@ -8,7 +8,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class CallbackMap {
|
class CallbackMap {
|
||||||
private ConcurrentHashMap<String, List<ActionBase>> handlers = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<String, List<ActionBase>> handlers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public void put(String target, ActionBase action) {
|
public void put(String target, ActionBase action) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class CloseMessage extends HubMessage {
|
class CloseMessage extends HubMessage {
|
||||||
String error;
|
String error;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
public class HandshakeProtocol {
|
class HandshakeProtocol {
|
||||||
public static Gson gson = new Gson();
|
public static Gson gson = new Gson();
|
||||||
private static final String RECORD_SEPARATOR = "\u001e";
|
private static final String RECORD_SEPARATOR = "\u001e";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class HandshakeRequestMessage {
|
class HandshakeRequestMessage {
|
||||||
String protocol;
|
String protocol;
|
||||||
int version;
|
int version;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class HandshakeResponseMessage {
|
class HandshakeResponseMessage {
|
||||||
public String error;
|
public String error;
|
||||||
|
|
||||||
public HandshakeResponseMessage() {
|
public HandshakeResponseMessage() {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,6 @@ package com.microsoft.aspnet.signalr;
|
||||||
/**
|
/**
|
||||||
* A base class for hub messages.
|
* A base class for hub messages.
|
||||||
*/
|
*/
|
||||||
public abstract class HubMessage {
|
abstract class HubMessage {
|
||||||
public abstract HubMessageType getMessageType();
|
public abstract HubMessageType getMessageType();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ package com.microsoft.aspnet.signalr;
|
||||||
/**
|
/**
|
||||||
* A protocol abstraction for communicating with SignalR hubs.
|
* A protocol abstraction for communicating with SignalR hubs.
|
||||||
*/
|
*/
|
||||||
public interface HubProtocol {
|
interface HubProtocol {
|
||||||
String getName();
|
String getName();
|
||||||
int getVersion();
|
int getVersion();
|
||||||
TransferFormat getTransferFormat();
|
TransferFormat getTransferFormat();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class InvocationMessage extends HubMessage {
|
class InvocationMessage extends HubMessage {
|
||||||
int type = HubMessageType.INVOCATION.value;
|
int type = HubMessageType.INVOCATION.value;
|
||||||
String invocationId;
|
String invocationId;
|
||||||
String target;
|
String target;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
public class JsonHubProtocol implements HubProtocol {
|
class JsonHubProtocol implements HubProtocol {
|
||||||
private final JsonParser jsonParser = new JsonParser();
|
private final JsonParser jsonParser = new JsonParser();
|
||||||
private final Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
private static final String RECORD_SEPARATOR = "\u001e";
|
private static final String RECORD_SEPARATOR = "\u001e";
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import okhttp3.Request;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
||||||
public class Negotiate {
|
class Negotiate {
|
||||||
|
|
||||||
public static NegotiateResponse processNegotiate(String url) throws IOException {
|
public static NegotiateResponse processNegotiate(String url) throws IOException {
|
||||||
return processNegotiate(url, null);
|
return processNegotiate(url, null);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
public class NegotiateResponse {
|
class NegotiateResponse {
|
||||||
private String connectionId;
|
private String connectionId;
|
||||||
private Set<String> availableTransports = new HashSet<>();
|
private Set<String> availableTransports = new HashSet<>();
|
||||||
private String redirectUrl;
|
private String redirectUrl;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class NullLogger implements Logger {
|
class NullLogger implements Logger {
|
||||||
@Override
|
@Override
|
||||||
public void log(LogLevel logLevel, String message) { }
|
public void log(LogLevel logLevel, String message) { }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface OnReceiveCallBack {
|
interface OnReceiveCallBack {
|
||||||
void invoke(String message) throws Exception;
|
void invoke(String message) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class PingMessage extends HubMessage {
|
class PingMessage extends HubMessage {
|
||||||
|
|
||||||
int type = HubMessageType.PING.value;
|
int type = HubMessageType.PING.value;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Transport {
|
interface Transport {
|
||||||
void start() throws Exception;
|
void start() throws Exception;
|
||||||
void send(String message) throws Exception;
|
void send(String message) throws Exception;
|
||||||
void setOnReceive(OnReceiveCallBack callback);
|
void setOnReceive(OnReceiveCallBack callback);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
||||||
import org.java_websocket.client.WebSocketClient;
|
import org.java_websocket.client.WebSocketClient;
|
||||||
import org.java_websocket.handshake.ServerHandshake;
|
import org.java_websocket.handshake.ServerHandshake;
|
||||||
|
|
||||||
public class WebSocketTransport implements Transport {
|
class WebSocketTransport implements Transport {
|
||||||
private WebSocketClient webSocketClient;
|
private WebSocketClient webSocketClient;
|
||||||
private OnReceiveCallBack onReceiveCallBack;
|
private OnReceiveCallBack onReceiveCallBack;
|
||||||
private URI url;
|
private URI url;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.microsoft.aspnet.signalr.HandshakeProtocol;
|
|
||||||
import com.microsoft.aspnet.signalr.HandshakeRequestMessage;
|
|
||||||
import com.microsoft.aspnet.signalr.HandshakeResponseMessage;
|
|
||||||
|
|
||||||
public class HandshakeProtocolTest {
|
public class HandshakeProtocolTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
@ -12,7 +12,6 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
import com.microsoft.aspnet.signalr.*;
|
|
||||||
|
|
||||||
public class HubConnectionTest {
|
public class HubConnectionTest {
|
||||||
private static final String RECORD_SEPARATOR = "\u001e";
|
private static final String RECORD_SEPARATOR = "\u001e";
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.microsoft.aspnet.signalr.HubException;
|
|
||||||
|
|
||||||
public class HubExceptionTest {
|
public class HubExceptionTest {
|
||||||
@Test
|
@Test
|
||||||
public void VeryHubExceptionMesssageIsSet() {
|
public void VeryHubExceptionMesssageIsSet() {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
@ -10,7 +10,6 @@ import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.microsoft.aspnet.signalr.*;
|
|
||||||
|
|
||||||
public class JsonHubProtocolTest {
|
public class JsonHubProtocolTest {
|
||||||
private JsonHubProtocol jsonHubProtocol = new JsonHubProtocol();
|
private JsonHubProtocol jsonHubProtocol = new JsonHubProtocol();
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.microsoft.aspnet.signalr.NegotiateResponse;
|
|
||||||
|
|
||||||
public class NegotiateResponseTest {
|
public class NegotiateResponseTest {
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
|
@ -12,7 +12,6 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
import com.microsoft.aspnet.signalr.Negotiate;
|
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class ResolveNegotiateUrlTest {
|
public class ResolveNegotiateUrlTest {
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
import com.microsoft.aspnet.signalr.NullLogger;
|
|
||||||
import com.microsoft.aspnet.signalr.Transport;
|
|
||||||
import com.microsoft.aspnet.signalr.WebSocketTransport;
|
|
||||||
|
|
||||||
public class WebSocketTransportTest {
|
public class WebSocketTransportTest {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
package com.microsoft.aspnet.signalr.test;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
@ -13,8 +13,6 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
import com.microsoft.aspnet.signalr.NullLogger;
|
|
||||||
import com.microsoft.aspnet.signalr.WebSocketTransport;
|
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class WebSocketTransportUrlFormatTest {
|
public class WebSocketTransportUrlFormatTest {
|
||||||
Loading…
Reference in New Issue