Making all the things Package Private in the Java Client (#2945)

This commit is contained in:
Mikael Mengistu 2018-09-11 16:56:37 -07:00 committed by GitHub
parent bfae012dd0
commit 9db1c2af1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 24 additions and 40 deletions

View File

@ -8,7 +8,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class CallbackMap {
class CallbackMap {
private ConcurrentHashMap<String, List<ActionBase>> handlers = new ConcurrentHashMap<>();
public void put(String target, ActionBase action) {

View File

@ -3,7 +3,7 @@
package com.microsoft.aspnet.signalr;
public class CloseMessage extends HubMessage {
class CloseMessage extends HubMessage {
String error;
@Override

View File

@ -5,7 +5,7 @@ package com.microsoft.aspnet.signalr;
import com.google.gson.Gson;
public class HandshakeProtocol {
class HandshakeProtocol {
public static Gson gson = new Gson();
private static final String RECORD_SEPARATOR = "\u001e";

View File

@ -3,7 +3,7 @@
package com.microsoft.aspnet.signalr;
public class HandshakeRequestMessage {
class HandshakeRequestMessage {
String protocol;
int version;

View File

@ -3,7 +3,7 @@
package com.microsoft.aspnet.signalr;
public class HandshakeResponseMessage {
class HandshakeResponseMessage {
public String error;
public HandshakeResponseMessage() {

View File

@ -6,6 +6,6 @@ package com.microsoft.aspnet.signalr;
/**
* A base class for hub messages.
*/
public abstract class HubMessage {
abstract class HubMessage {
public abstract HubMessageType getMessageType();
}

View File

@ -6,7 +6,7 @@ package com.microsoft.aspnet.signalr;
/**
* A protocol abstraction for communicating with SignalR hubs.
*/
public interface HubProtocol {
interface HubProtocol {
String getName();
int getVersion();
TransferFormat getTransferFormat();

View File

@ -3,7 +3,7 @@
package com.microsoft.aspnet.signalr;
public class InvocationMessage extends HubMessage {
class InvocationMessage extends HubMessage {
int type = HubMessageType.INVOCATION.value;
String invocationId;
String target;

View File

@ -11,7 +11,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class JsonHubProtocol implements HubProtocol {
class JsonHubProtocol implements HubProtocol {
private final JsonParser jsonParser = new JsonParser();
private final Gson gson = new Gson();
private static final String RECORD_SEPARATOR = "\u001e";

View File

@ -10,7 +10,7 @@ import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class Negotiate {
class Negotiate {
public static NegotiateResponse processNegotiate(String url) throws IOException {
return processNegotiate(url, null);

View File

@ -10,7 +10,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class NegotiateResponse {
class NegotiateResponse {
private String connectionId;
private Set<String> availableTransports = new HashSet<>();
private String redirectUrl;

View File

@ -3,7 +3,7 @@
package com.microsoft.aspnet.signalr;
public class NullLogger implements Logger {
class NullLogger implements Logger {
@Override
public void log(LogLevel logLevel, String message) { }

View File

@ -3,6 +3,6 @@
package com.microsoft.aspnet.signalr;
public interface OnReceiveCallBack {
interface OnReceiveCallBack {
void invoke(String message) throws Exception;
}

View File

@ -3,7 +3,7 @@
package com.microsoft.aspnet.signalr;
public class PingMessage extends HubMessage {
class PingMessage extends HubMessage {
int type = HubMessageType.PING.value;

View File

@ -3,7 +3,7 @@
package com.microsoft.aspnet.signalr;
public interface Transport {
interface Transport {
void start() throws Exception;
void send(String message) throws Exception;
void setOnReceive(OnReceiveCallBack callback);

View File

@ -10,7 +10,7 @@ import java.util.Map;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
public class WebSocketTransport implements Transport {
class WebSocketTransport implements Transport {
private WebSocketClient webSocketClient;
private OnReceiveCallBack onReceiveCallBack;
private URI url;

View File

@ -1,16 +1,12 @@
// 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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import static org.junit.Assert.*;
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 {
@Test

View File

@ -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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import static org.junit.Assert.*;
@ -12,7 +12,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import com.microsoft.aspnet.signalr.*;
public class HubConnectionTest {
private static final String RECORD_SEPARATOR = "\u001e";

View File

@ -1,14 +1,12 @@
// 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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.microsoft.aspnet.signalr.HubException;
public class HubExceptionTest {
@Test
public void VeryHubExceptionMesssageIsSet() {

View File

@ -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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import static org.junit.Assert.*;
@ -10,7 +10,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import com.google.gson.JsonArray;
import com.microsoft.aspnet.signalr.*;
public class JsonHubProtocolTest {
private JsonHubProtocol jsonHubProtocol = new JsonHubProtocol();

View File

@ -1,13 +1,12 @@
// 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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import static org.junit.Assert.*;
import org.junit.Test;
import com.microsoft.aspnet.signalr.NegotiateResponse;
public class NegotiateResponseTest {

View File

@ -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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import static org.junit.Assert.assertEquals;
@ -12,7 +12,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import com.microsoft.aspnet.signalr.Negotiate;
@RunWith(Parameterized.class)
public class ResolveNegotiateUrlTest {

View File

@ -1,16 +1,12 @@
// 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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import org.junit.Rule;
import org.junit.Test;
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 {
@Rule

View File

@ -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.aspnet.signalr.test;
package com.microsoft.aspnet.signalr;
import static org.junit.Assert.*;
@ -13,8 +13,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import com.microsoft.aspnet.signalr.NullLogger;
import com.microsoft.aspnet.signalr.WebSocketTransport;
@RunWith(Parameterized.class)
public class WebSocketTransportUrlFormatTest {