This is an automated email from the ASF dual-hosted git repository. yukon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/rocketmq-remoting.git
commit 20e0a71c4e8662fd48468456b86428401eb2cde1 Author: yukon <[email protected]> AuthorDate: Mon Jun 10 16:46:26 2019 +0800 Do some renaming polish --- ...{ByteBufferWrapper.java => RemotingBuffer.java} | 2 +- ...Exception.java => RemotingAccessException.java} | 12 ++++---- ...cException.java => RemotingCodecException.java} | 6 ++-- ...n.java => RemotingConnectFailureException.java} | 12 ++++---- ...xception.java => RemotingRuntimeException.java} | 10 +++--- ...xception.java => RemotingTimeoutException.java} | 20 ++++++------ .../api/exception/SemaphoreExhaustedException.java | 2 +- .../rocketmq/remoting/common/ResponseFuture.java | 8 ++--- ...BufferWrapper.java => NettyRemotingBuffer.java} | 6 ++-- .../remoting/impl/command/CodecHelper.java | 20 ++++++------ .../remoting/impl/netty/NettyRemotingAbstract.java | 20 ++++++------ .../remoting/impl/netty/NettyRemotingClient.java | 8 ++--- .../remoting/impl/netty/handler/Decoder.java | 20 ++++++------ .../remoting/impl/netty/handler/Encoder.java | 12 ++++---- .../remoting/common/ResponseFutureTest.java | 6 ++-- .../remoting/impl/command/CodecHelperTest.java | 36 +++++++++++----------- ...nTest.java => EpollRemotingConnectionTest.java} | 2 +- .../impl/netty/NettyRemotingAbstractTest.java | 14 ++++----- .../impl/netty/NettyRemotingClientTest.java | 14 ++++----- ...nTest.java => NettyRemotingConnectionTest.java} | 2 +- .../remoting/impl/netty/handler/EncoderTest.java | 4 +-- .../impl/netty/handler/ExceptionHandlerTest.java | 4 +-- 22 files changed, 120 insertions(+), 120 deletions(-) diff --git a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/buffer/ByteBufferWrapper.java b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/buffer/RemotingBuffer.java similarity index 97% rename from remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/buffer/ByteBufferWrapper.java rename to remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/buffer/RemotingBuffer.java index 0b0c5fb..e601721 100644 --- a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/buffer/ByteBufferWrapper.java +++ b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/buffer/RemotingBuffer.java @@ -19,7 +19,7 @@ package org.apache.rocketmq.remoting.api.buffer; import java.nio.ByteBuffer; -public interface ByteBufferWrapper { +public interface RemotingBuffer { void writeByte(byte data); void writeByte(int index, byte data); diff --git a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteAccessException.java b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingAccessException.java similarity index 80% rename from remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteAccessException.java rename to remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingAccessException.java index d6d46f0..69d5b98 100644 --- a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteAccessException.java +++ b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingAccessException.java @@ -22,7 +22,7 @@ package org.apache.rocketmq.remoting.api.exception; * protocol should throw this exception or subclasses of it, in order * to transparently expose a plain Java business interface. * - * <p>A client may catch RemoteAccessException if it wants to, but as + * <p>A client may catch RemotingAccessException if it wants to, but as * remote access errors are typically unrecoverable, it will probably let * such exceptions propagate to a higher level that handles them generically. * In this case, the client opCode doesn't show any signs of being involved in @@ -30,27 +30,27 @@ package org.apache.rocketmq.remoting.api.exception; * * @since 1.0.0 */ -public class RemoteAccessException extends RemoteRuntimeException { +public class RemotingAccessException extends RemotingRuntimeException { private static final long serialVersionUID = 6280428909532427263L; /** - * Constructor for RemoteAccessException with the specified detail message. + * Constructor for RemotingAccessException with the specified detail message. * * @param msg the detail message */ - public RemoteAccessException(String msg) { + public RemotingAccessException(String msg) { super(msg); } /** - * Constructor for RemoteAccessException with the specified detail message + * Constructor for RemotingAccessException with the specified detail message * and nested exception. * * @param msg the detail message * @param cause the root cause (usually from using an underlying * remoting API such as RMI) */ - public RemoteAccessException(String msg, Throwable cause) { + public RemotingAccessException(String msg, Throwable cause) { super(msg, cause); } diff --git a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteCodecException.java b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingCodecException.java similarity index 84% rename from remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteCodecException.java rename to remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingCodecException.java index a8b9e4e..3d049b8 100644 --- a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteCodecException.java +++ b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingCodecException.java @@ -20,14 +20,14 @@ package org.apache.rocketmq.remoting.api.exception; /** * @since 1.0.0 */ -public class RemoteCodecException extends RemoteAccessException { +public class RemotingCodecException extends RemotingAccessException { private static final long serialVersionUID = -7597014042746200543L; - public RemoteCodecException(String msg) { + public RemotingCodecException(String msg) { super(msg); } - public RemoteCodecException(String msg, Throwable cause) { + public RemotingCodecException(String msg, Throwable cause) { super(msg, cause); } } diff --git a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteConnectFailureException.java b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingConnectFailureException.java similarity index 73% rename from remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteConnectFailureException.java rename to remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingConnectFailureException.java index af0a6e9..70cc3d9 100644 --- a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteConnectFailureException.java +++ b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingConnectFailureException.java @@ -18,31 +18,31 @@ package org.apache.rocketmq.remoting.api.exception; /** - * RemoteConnectFailureException will be thrown when connection + * RemotingConnectFailureException will be thrown when connection * could not be established with a remote service. * * @since 1.0.0 */ -public class RemoteConnectFailureException extends RemoteAccessException { +public class RemotingConnectFailureException extends RemotingAccessException { private static final long serialVersionUID = -5565366231695911316L; /** - * Constructor for RemoteConnectFailureException with the specified detail message + * Constructor for RemotingConnectFailureException with the specified detail message * and nested exception. * * @param msg the detail message * @param cause the root cause from the remoting API in use */ - public RemoteConnectFailureException(String msg, Throwable cause) { + public RemotingConnectFailureException(String msg, Throwable cause) { super(msg, cause); } /** - * Constructor for RemoteConnectFailureException with the specified detail message. + * Constructor for RemotingConnectFailureException with the specified detail message. * * @param msg the detail message */ - public RemoteConnectFailureException(String msg) { + public RemotingConnectFailureException(String msg) { super(msg); } diff --git a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteRuntimeException.java b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingRuntimeException.java similarity index 88% rename from remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteRuntimeException.java rename to remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingRuntimeException.java index a83be9f..ced6648 100644 --- a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteRuntimeException.java +++ b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingRuntimeException.java @@ -27,26 +27,26 @@ package org.apache.rocketmq.remoting.api.exception; * * @since 1.0.0 */ -public abstract class RemoteRuntimeException extends RuntimeException { +public abstract class RemotingRuntimeException extends RuntimeException { private static final long serialVersionUID = -8371779880133933367L; /** - * Construct a {@code RemoteRuntimeException} with the specified detail message. + * Construct a {@code RemotingRuntimeException} with the specified detail message. * * @param msg the detail message */ - public RemoteRuntimeException(String msg) { + public RemotingRuntimeException(String msg) { super(msg); } /** - * Construct a {@code RemoteRuntimeException} with the specified detail message + * Construct a {@code RemotingRuntimeException} with the specified detail message * and nested exception. * * @param msg the detail message * @param cause the nested exception */ - public RemoteRuntimeException(String msg, Throwable cause) { + public RemotingRuntimeException(String msg, Throwable cause) { super(msg, cause); } diff --git a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteTimeoutException.java b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingTimeoutException.java similarity index 69% rename from remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteTimeoutException.java rename to remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingTimeoutException.java index adfcc8d..37761f9 100644 --- a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemoteTimeoutException.java +++ b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/RemotingTimeoutException.java @@ -17,54 +17,54 @@ package org.apache.rocketmq.remoting.api.exception; /** - * RemoteTimeoutException will be thrown when the execution + * RemotingTimeoutException will be thrown when the execution * of the target method did not complete before a configurable * timeout, for example when a reply message was not received. * * @since 1.0.0 */ -public class RemoteTimeoutException extends RemoteAccessException { +public class RemotingTimeoutException extends RemotingAccessException { private static final long serialVersionUID = 8710772392914461626L; /** - * Constructor for RemoteTimeoutException with the specified detail message,configurable timeout. + * Constructor for RemotingTimeoutException with the specified detail message,configurable timeout. * * @param msg the detail message * @param timeoutMillis configurable timeout */ - public RemoteTimeoutException(String msg, long timeoutMillis) { + public RemotingTimeoutException(String msg, long timeoutMillis) { this(msg, timeoutMillis, null); } /** - * Constructor for RemoteTimeoutException with the specified detail message,configurable timeout + * Constructor for RemotingTimeoutException with the specified detail message,configurable timeout * and nested exception.. * * @param msg the detail message * @param timeoutMillis configurable timeout * @param cause Exception cause */ - public RemoteTimeoutException(String msg, long timeoutMillis, Throwable cause) { + public RemotingTimeoutException(String msg, long timeoutMillis, Throwable cause) { super(String.format("%s, waiting for %s ms", msg, timeoutMillis), cause); } /** - * Constructor for RemoteTimeoutException with the specified detail message. + * Constructor for RemotingTimeoutException with the specified detail message. * * @param msg the detail message */ - public RemoteTimeoutException(String msg) { + public RemotingTimeoutException(String msg) { super(msg); } /** - * Constructor for RemoteTimeoutException with the specified detail message + * Constructor for RemotingTimeoutException with the specified detail message * and nested exception. * * @param msg the detail message * @param cause the root cause from the remoting API in use */ - public RemoteTimeoutException(String msg, Throwable cause) { + public RemotingTimeoutException(String msg, Throwable cause) { super(msg, cause); } } diff --git a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/SemaphoreExhaustedException.java b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/SemaphoreExhaustedException.java index a4e6d16..9457bf9 100644 --- a/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/SemaphoreExhaustedException.java +++ b/remoting-core/remoting-api/src/main/java/org/apache/rocketmq/remoting/api/exception/SemaphoreExhaustedException.java @@ -17,7 +17,7 @@ package org.apache.rocketmq.remoting.api.exception; -public class SemaphoreExhaustedException extends RemoteRuntimeException { +public class SemaphoreExhaustedException extends RemotingRuntimeException { private static final long serialVersionUID = 6280428909532427263L; /** diff --git a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/common/ResponseFuture.java b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/common/ResponseFuture.java index 6a2f246..705a0d4 100644 --- a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/common/ResponseFuture.java +++ b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/common/ResponseFuture.java @@ -25,7 +25,7 @@ import org.apache.commons.lang3.builder.ToStringExclude; import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.rocketmq.remoting.api.AsyncHandler; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.api.exception.RemoteRuntimeException; +import org.apache.rocketmq.remoting.api.exception.RemotingRuntimeException; import org.jetbrains.annotations.Nullable; public class ResponseFuture { @@ -44,7 +44,7 @@ public class ResponseFuture { private volatile RemotingCommand responseCommand; private volatile boolean sendRequestOK = true; - private volatile RemoteRuntimeException cause; + private volatile RemotingRuntimeException cause; @ToStringExclude private SemaphoreReleaseOnlyOnce once; @@ -117,11 +117,11 @@ public class ResponseFuture { return asyncHandler; } - public RemoteRuntimeException getCause() { + public RemotingRuntimeException getCause() { return cause; } - public void setCause(RemoteRuntimeException cause) { + public void setCause(RemotingRuntimeException cause) { this.cause = cause; } diff --git a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/buffer/NettyByteBufferWrapper.java b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/buffer/NettyRemotingBuffer.java similarity index 93% rename from remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/buffer/NettyByteBufferWrapper.java rename to remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/buffer/NettyRemotingBuffer.java index 43545fe..1d9d388 100644 --- a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/buffer/NettyByteBufferWrapper.java +++ b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/buffer/NettyRemotingBuffer.java @@ -19,12 +19,12 @@ package org.apache.rocketmq.remoting.impl.buffer; import io.netty.buffer.ByteBuf; import java.nio.ByteBuffer; -import org.apache.rocketmq.remoting.api.buffer.ByteBufferWrapper; +import org.apache.rocketmq.remoting.api.buffer.RemotingBuffer; -public class NettyByteBufferWrapper implements ByteBufferWrapper { +public class NettyRemotingBuffer implements RemotingBuffer { private final ByteBuf buffer; - public NettyByteBufferWrapper(ByteBuf buffer) { + public NettyRemotingBuffer(ByteBuf buffer) { this.buffer = buffer; } diff --git a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/command/CodecHelper.java b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/command/CodecHelper.java index 988c20c..79ecb56 100644 --- a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/command/CodecHelper.java +++ b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/command/CodecHelper.java @@ -19,10 +19,10 @@ package org.apache.rocketmq.remoting.impl.command; import java.nio.charset.Charset; import java.util.Map.Entry; -import org.apache.rocketmq.remoting.api.buffer.ByteBufferWrapper; +import org.apache.rocketmq.remoting.api.buffer.RemotingBuffer; import org.apache.rocketmq.remoting.api.command.RemotingCommand; import org.apache.rocketmq.remoting.api.command.TrafficType; -import org.apache.rocketmq.remoting.api.exception.RemoteCodecException; +import org.apache.rocketmq.remoting.api.exception.RemotingCodecException; public class CodecHelper { // ProtocolMagic(1) + TotalLength(4) + CmdCode(2) + CmdVersion(2) + RequestID(4) + TrafficType(1) + OpCode(2) @@ -36,7 +36,7 @@ public class CodecHelper { private final static char PROPERTY_SEPARATOR = '\n'; private final static Charset REMOTING_CHARSET = Charset.forName("UTF-8"); - public static void encodeCommand(final RemotingCommand command, final ByteBufferWrapper out) { + public static void encodeCommand(final RemotingCommand command, final RemotingBuffer out) { out.writeByte(PROTOCOL_MAGIC); short remarkLen = 0; @@ -44,7 +44,7 @@ public class CodecHelper { if (command.remark() != null) { remark = command.remark().getBytes(REMOTING_CHARSET); if (remark.length > REMARK_MAX_LEN) { - throw new RemoteCodecException(String.format("Remark len: %d over max limit: %d", remark.length, REMARK_MAX_LEN)); + throw new RemotingCodecException(String.format("Remark len: %d over max limit: %d", remark.length, REMARK_MAX_LEN)); } remarkLen = (short) remark.length; } @@ -64,7 +64,7 @@ public class CodecHelper { props[i] = sb.toString().getBytes(REMOTING_CHARSET); if (props[i].length > Short.MAX_VALUE) { - throw new RemoteCodecException(String.format("Property KV len: %d over max limit: %d", props[i].length, Short.MAX_VALUE)); + throw new RemotingCodecException(String.format("Property KV len: %d over max limit: %d", props[i].length, Short.MAX_VALUE)); } propsLen += 2; @@ -74,13 +74,13 @@ public class CodecHelper { } if (propsLen > PROPERTY_MAX_LEN) { - throw new RemoteCodecException(String.format("Properties total len: %d over max limit: %d", propsLen, PROPERTY_MAX_LEN)); + throw new RemotingCodecException(String.format("Properties total len: %d over max limit: %d", propsLen, PROPERTY_MAX_LEN)); } int payloadLen = command.payload() == null ? 0 : command.payload().length; if (payloadLen > PAYLOAD_MAX_LEN) { - throw new RemoteCodecException(String.format("Payload len: %d over max limit: %d", payloadLen, PAYLOAD_MAX_LEN)); + throw new RemotingCodecException(String.format("Payload len: %d over max limit: %d", payloadLen, PAYLOAD_MAX_LEN)); } int totalLength = MIN_PROTOCOL_LEN @@ -116,7 +116,7 @@ public class CodecHelper { } } - public static RemotingCommand decode(final ByteBufferWrapper in) { + public static RemotingCommand decode(final RemotingBuffer in) { RemotingCommandImpl cmd = new RemotingCommandImpl(); cmd.cmdCode(in.readShort()); @@ -153,7 +153,7 @@ public class CodecHelper { propsLen += 2; propsLen += length; if (propsLen > PROPERTY_MAX_LEN) { - throw new RemoteCodecException(String.format("Properties total len: %d over max limit: %d", propsLen, PROPERTY_MAX_LEN)); + throw new RemotingCodecException(String.format("Properties total len: %d over max limit: %d", propsLen, PROPERTY_MAX_LEN)); } } } @@ -161,7 +161,7 @@ public class CodecHelper { int payloadLen = in.readInt(); if (payloadLen > PAYLOAD_MAX_LEN) { - throw new RemoteCodecException(String.format("Payload len: %d over max limit: %d", payloadLen, PAYLOAD_MAX_LEN)); + throw new RemotingCodecException(String.format("Payload len: %d over max limit: %d", payloadLen, PAYLOAD_MAX_LEN)); } if (payloadLen > 0) { diff --git a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java index 74a39d2..05bded4 100644 --- a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java +++ b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstract.java @@ -42,9 +42,9 @@ import org.apache.rocketmq.remoting.api.channel.RemotingChannel; import org.apache.rocketmq.remoting.api.command.RemotingCommand; import org.apache.rocketmq.remoting.api.command.RemotingCommandFactory; import org.apache.rocketmq.remoting.api.command.TrafficType; -import org.apache.rocketmq.remoting.api.exception.RemoteAccessException; -import org.apache.rocketmq.remoting.api.exception.RemoteRuntimeException; -import org.apache.rocketmq.remoting.api.exception.RemoteTimeoutException; +import org.apache.rocketmq.remoting.api.exception.RemotingAccessException; +import org.apache.rocketmq.remoting.api.exception.RemotingRuntimeException; +import org.apache.rocketmq.remoting.api.exception.RemotingTimeoutException; import org.apache.rocketmq.remoting.api.exception.SemaphoreExhaustedException; import org.apache.rocketmq.remoting.api.interceptor.Interceptor; import org.apache.rocketmq.remoting.api.interceptor.InterceptorGroup; @@ -169,7 +169,7 @@ public abstract class NettyRemotingAbstract implements RemotingService { if (rf != null) { LOG.warn("Removes timeout request {} ", rf.getRequestCommand()); - rf.setCause(new RemoteTimeoutException(String.format("Request to %s timeout", rf.getRemoteAddr()), rf.getTimeoutMillis())); + rf.setCause(new RemotingTimeoutException(String.format("Request to %s timeout", rf.getRemoteAddr()), rf.getTimeoutMillis())); executeAsyncHandler(rf); } } @@ -327,7 +327,7 @@ public abstract class NettyRemotingAbstract implements RemotingService { } } - private void requestFail(final int requestID, final RemoteRuntimeException cause) { + private void requestFail(final int requestID, final RemotingRuntimeException cause) { ResponseFuture responseFuture = ackTables.remove(requestID); if (responseFuture != null) { responseFuture.setSendRequestOK(false); @@ -337,7 +337,7 @@ public abstract class NettyRemotingAbstract implements RemotingService { } } - private void requestFail(final ResponseFuture responseFuture, final RemoteRuntimeException cause) { + private void requestFail(final ResponseFuture responseFuture, final RemotingRuntimeException cause) { responseFuture.setCause(cause); executeAsyncHandler(responseFuture); } @@ -396,7 +396,7 @@ public abstract class NettyRemotingAbstract implements RemotingService { responseFuture.setSendRequestOK(false); ackTables.remove(requestID); - responseFuture.setCause(new RemoteAccessException(RemotingUtil.extractRemoteAddress(channel), f.cause())); + responseFuture.setCause(new RemotingAccessException(RemotingUtil.extractRemoteAddress(channel), f.cause())); responseFuture.putResponse(null); LOG.warn("Send request command to {} failed !", remoteAddr); @@ -410,7 +410,7 @@ public abstract class NettyRemotingAbstract implements RemotingService { if (null == responseCommand) { if (responseFuture.isSendRequestOK()) { - responseFuture.setCause(new RemoteTimeoutException(RemotingUtil.extractRemoteAddress(channel), timeoutMillis)); + responseFuture.setCause(new RemotingTimeoutException(RemotingUtil.extractRemoteAddress(channel), timeoutMillis)); throw responseFuture.getCause(); } else { throw responseFuture.getCause(); @@ -460,14 +460,14 @@ public abstract class NettyRemotingAbstract implements RemotingService { return; } - requestFail(requestID, new RemoteAccessException(RemotingUtil.extractRemoteAddress(channel), f.cause())); + requestFail(requestID, new RemotingAccessException(RemotingUtil.extractRemoteAddress(channel), f.cause())); LOG.warn("Send request command to channel failed.", remoteAddr); } }; this.writeAndFlush(channel, request, listener); } catch (Exception e) { - requestFail(requestID, new RemoteAccessException(RemotingUtil.extractRemoteAddress(channel), e)); + requestFail(requestID, new RemotingAccessException(RemotingUtil.extractRemoteAddress(channel), e)); LOG.error("Send request command to channel " + channel + " error !", e); } } else { diff --git a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClient.java b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClient.java index 9f0fd1c..531c3db 100644 --- a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClient.java +++ b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClient.java @@ -42,8 +42,8 @@ import org.apache.rocketmq.remoting.api.AsyncHandler; import org.apache.rocketmq.remoting.api.RemotingClient; import org.apache.rocketmq.remoting.api.command.RemotingCommand; import org.apache.rocketmq.remoting.api.command.TrafficType; -import org.apache.rocketmq.remoting.api.exception.RemoteConnectFailureException; -import org.apache.rocketmq.remoting.api.exception.RemoteTimeoutException; +import org.apache.rocketmq.remoting.api.exception.RemotingConnectFailureException; +import org.apache.rocketmq.remoting.api.exception.RemotingTimeoutException; import org.apache.rocketmq.remoting.config.RemotingClientConfig; import org.apache.rocketmq.remoting.external.ThreadUtils; import org.apache.rocketmq.remoting.impl.netty.handler.Decoder; @@ -144,7 +144,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti try { return this.invokeWithInterceptor(channel, request, timeoutMillis); - } catch (RemoteTimeoutException e) { + } catch (RemotingTimeoutException e) { if (this.clientConfig.isClientCloseSocketIfTimeout()) { LOG.warn("invoke: timeout, so close the socket {} ms, {}", timeoutMillis, address); this.clientChannelManager.closeChannel(address, channel); @@ -159,7 +159,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti } } else { this.clientChannelManager.closeChannel(address, channel); - throw new RemoteConnectFailureException(address); + throw new RemotingConnectFailureException(address); } } diff --git a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Decoder.java b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Decoder.java index 4a906cf..4a6f729 100644 --- a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Decoder.java +++ b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Decoder.java @@ -23,10 +23,10 @@ import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; import java.util.List; -import org.apache.rocketmq.remoting.api.buffer.ByteBufferWrapper; +import org.apache.rocketmq.remoting.api.buffer.RemotingBuffer; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.api.exception.RemoteCodecException; -import org.apache.rocketmq.remoting.impl.buffer.NettyByteBufferWrapper; +import org.apache.rocketmq.remoting.api.exception.RemotingCodecException; +import org.apache.rocketmq.remoting.impl.buffer.NettyRemotingBuffer; import org.apache.rocketmq.remoting.impl.command.CodecHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,7 +43,7 @@ public class Decoder extends ByteToMessageDecoder { return; } - NettyByteBufferWrapper wrapper = new NettyByteBufferWrapper(in); + NettyRemotingBuffer wrapper = new NettyRemotingBuffer(in); Object msg = this.decode(ctx, wrapper); if (msg != null) { @@ -51,16 +51,16 @@ public class Decoder extends ByteToMessageDecoder { } } - private Object decode(final ChannelHandlerContext ctx, ByteBufferWrapper wrapper) throws Exception { + private Object decode(final ChannelHandlerContext ctx, RemotingBuffer wrapper) throws Exception { int originReaderIndex = wrapper.readerIndex(); byte magic = wrapper.readByte(); try { if (magic != CodecHelper.PROTOCOL_MAGIC) { - throw new RemoteCodecException(String.format("MagicCode %d is wrong, expect %d", magic, CodecHelper.PROTOCOL_MAGIC)); + throw new RemotingCodecException(String.format("MagicCode %d is wrong, expect %d", magic, CodecHelper.PROTOCOL_MAGIC)); } return decode(wrapper, originReaderIndex); - } catch (final RemoteCodecException e) { + } catch (final RemotingCodecException e) { LOG.warn("Decode error {}, close the channel {}", e.getMessage(), ctx.channel()); ctx.channel().close().addListener(new ChannelFutureListener() { @Override @@ -72,7 +72,7 @@ public class Decoder extends ByteToMessageDecoder { return null; } - public RemotingCommand decode(final ByteBufferWrapper wrapper, final int originReaderIndex) { + public RemotingCommand decode(final RemotingBuffer wrapper, final int originReaderIndex) { // Full message isn't available yet, return nothing for now if (wrapper.readableBytes() < CodecHelper.MIN_PROTOCOL_LEN - 1 /*MagicCode*/) { wrapper.setReaderIndex(originReaderIndex); @@ -82,11 +82,11 @@ public class Decoder extends ByteToMessageDecoder { int totalLength = wrapper.readInt(); if (totalLength <= 0) { - throw new RemoteCodecException("Illegal total length " + totalLength); + throw new RemotingCodecException("Illegal total length " + totalLength); } if (totalLength > CodecHelper.PACKET_MAX_LEN) { - throw new RemoteCodecException(String.format("Total length %d is more than limit %d", totalLength, CodecHelper.PACKET_MAX_LEN)); + throw new RemotingCodecException(String.format("Total length %d is more than limit %d", totalLength, CodecHelper.PACKET_MAX_LEN)); } if (wrapper.readableBytes() < totalLength - 1 /*MagicCode*/ - 4 /*TotalLen*/) { diff --git a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Encoder.java b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Encoder.java index 3c5a90e..cbfc5fc 100644 --- a/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Encoder.java +++ b/remoting-core/remoting-impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Encoder.java @@ -22,10 +22,10 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; -import org.apache.rocketmq.remoting.api.buffer.ByteBufferWrapper; +import org.apache.rocketmq.remoting.api.buffer.RemotingBuffer; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.api.exception.RemoteCodecException; -import org.apache.rocketmq.remoting.impl.buffer.NettyByteBufferWrapper; +import org.apache.rocketmq.remoting.api.exception.RemotingCodecException; +import org.apache.rocketmq.remoting.impl.buffer.NettyRemotingBuffer; import org.apache.rocketmq.remoting.impl.command.CodecHelper; import org.apache.rocketmq.remoting.internal.RemotingUtil; import org.slf4j.Logger; @@ -40,10 +40,10 @@ public class Encoder extends MessageToByteEncoder<RemotingCommand> { @Override public void encode(final ChannelHandlerContext ctx, RemotingCommand remotingCommand, ByteBuf out) throws Exception { try { - ByteBufferWrapper wrapper = new NettyByteBufferWrapper(out); + RemotingBuffer wrapper = new NettyRemotingBuffer(out); encode(remotingCommand, wrapper); - } catch (final RemoteCodecException e) { + } catch (final RemotingCodecException e) { String remoteAddress = RemotingUtil.extractRemoteAddress(ctx.channel()); LOG.error(String.format("Error occurred when encoding command for channel %s", remoteAddress), e); @@ -56,7 +56,7 @@ public class Encoder extends MessageToByteEncoder<RemotingCommand> { } } - private void encode(final RemotingCommand remotingCommand, final ByteBufferWrapper out) { + private void encode(final RemotingCommand remotingCommand, final RemotingBuffer out) { CodecHelper.encodeCommand(remotingCommand, out); } } diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/common/ResponseFutureTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/common/ResponseFutureTest.java index 1a16e56..302771d 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/common/ResponseFutureTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/common/ResponseFutureTest.java @@ -21,8 +21,8 @@ import java.util.concurrent.TimeUnit; import org.apache.rocketmq.remoting.BaseTest; import org.apache.rocketmq.remoting.api.AsyncHandler; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.api.exception.RemoteAccessException; -import org.apache.rocketmq.remoting.api.exception.RemoteRuntimeException; +import org.apache.rocketmq.remoting.api.exception.RemotingAccessException; +import org.apache.rocketmq.remoting.api.exception.RemotingRuntimeException; import org.apache.rocketmq.remoting.impl.command.RemotingCommandFactoryImpl; import org.junit.Test; @@ -58,7 +58,7 @@ public class ResponseFutureTest extends BaseTest { public void executeAsyncHandler_Failure() { final RemotingCommand reqCommand = factory.createRequest(); final RemotingCommand resCommand = factory.createResponse(reqCommand); - final RemoteRuntimeException exception = new RemoteAccessException("Test Exception"); + final RemotingRuntimeException exception = new RemotingAccessException("Test Exception"); future = new ResponseFuture(1, 3000, new AsyncHandler() { @Override public void onFailure(final RemotingCommand request, final Throwable cause) { diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/command/CodecHelperTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/command/CodecHelperTest.java index c8bdeb9..acf6e71 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/command/CodecHelperTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/command/CodecHelperTest.java @@ -20,10 +20,10 @@ package org.apache.rocketmq.remoting.impl.command; import io.netty.buffer.ByteBufAllocator; import org.apache.commons.lang3.RandomStringUtils; import org.apache.rocketmq.remoting.BaseTest; -import org.apache.rocketmq.remoting.api.buffer.ByteBufferWrapper; +import org.apache.rocketmq.remoting.api.buffer.RemotingBuffer; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.api.exception.RemoteCodecException; -import org.apache.rocketmq.remoting.impl.buffer.NettyByteBufferWrapper; +import org.apache.rocketmq.remoting.api.exception.RemotingCodecException; +import org.apache.rocketmq.remoting.impl.buffer.NettyRemotingBuffer; import org.junit.Test; import static org.apache.rocketmq.remoting.impl.command.CodecHelper.PAYLOAD_MAX_LEN; @@ -37,7 +37,7 @@ public class CodecHelperTest extends BaseTest { @Test public void encodeAndDecodeCommand_Success() { - ByteBufferWrapper buffer = new NettyByteBufferWrapper(ByteBufAllocator.DEFAULT.heapBuffer()); + RemotingBuffer buffer = new NettyRemotingBuffer(ByteBufAllocator.DEFAULT.heapBuffer()); RemotingCommand command = randomRemotingCommand(); CodecHelper.encodeCommand(command, buffer); @@ -52,16 +52,16 @@ public class CodecHelperTest extends BaseTest { @Test public void encodeCommand_LenOverLimit_ExceptionThrown() { - ByteBufferWrapper buffer = new NettyByteBufferWrapper(ByteBufAllocator.DEFAULT.heapBuffer()); + RemotingBuffer buffer = new NettyRemotingBuffer(ByteBufAllocator.DEFAULT.heapBuffer()); RemotingCommand command = randomRemotingCommand(); // Remark len exceed max limit command.remark(RandomStringUtils.randomAlphabetic(CodecHelper.REMARK_MAX_LEN + 1)); try { CodecHelper.encodeCommand(command, buffer); - failBecauseExceptionWasNotThrown(RemoteCodecException.class); + failBecauseExceptionWasNotThrown(RemotingCodecException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteCodecException.class); + assertThat(e).isInstanceOf(RemotingCodecException.class); } command = randomRemotingCommand(); @@ -69,9 +69,9 @@ public class CodecHelperTest extends BaseTest { try { CodecHelper.encodeCommand(command, buffer); - failBecauseExceptionWasNotThrown(RemoteCodecException.class); + failBecauseExceptionWasNotThrown(RemotingCodecException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteCodecException.class); + assertThat(e).isInstanceOf(RemotingCodecException.class); } command = randomRemotingCommand(); @@ -79,9 +79,9 @@ public class CodecHelperTest extends BaseTest { try { CodecHelper.encodeCommand(command, buffer); - failBecauseExceptionWasNotThrown(RemoteCodecException.class); + failBecauseExceptionWasNotThrown(RemotingCodecException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteCodecException.class); + assertThat(e).isInstanceOf(RemotingCodecException.class); } command = randomRemotingCommand(); @@ -89,15 +89,15 @@ public class CodecHelperTest extends BaseTest { try { CodecHelper.encodeCommand(command, buffer); - failBecauseExceptionWasNotThrown(RemoteCodecException.class); + failBecauseExceptionWasNotThrown(RemotingCodecException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteCodecException.class); + assertThat(e).isInstanceOf(RemotingCodecException.class); } } @Test public void decodeCommand_LenOverLimit_ExceptionThrown() { - ByteBufferWrapper buffer = new NettyByteBufferWrapper(ByteBufAllocator.DEFAULT.heapBuffer()); + RemotingBuffer buffer = new NettyRemotingBuffer(ByteBufAllocator.DEFAULT.heapBuffer()); buffer.writeShort((short) 0); buffer.writeShort((short) 0); @@ -118,9 +118,9 @@ public class CodecHelperTest extends BaseTest { try { CodecHelper.decode(buffer); - failBecauseExceptionWasNotThrown(RemoteCodecException.class); + failBecauseExceptionWasNotThrown(RemotingCodecException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteCodecException.class); + assertThat(e).isInstanceOf(RemotingCodecException.class); } buffer.setReaderIndex(0); @@ -131,9 +131,9 @@ public class CodecHelperTest extends BaseTest { try { CodecHelper.decode(buffer); - failBecauseExceptionWasNotThrown(RemoteCodecException.class); + failBecauseExceptionWasNotThrown(RemotingCodecException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteCodecException.class); + assertThat(e).isInstanceOf(RemotingCodecException.class); } } } \ No newline at end of file diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/EpollRemoteConnectionTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/EpollRemotingConnectionTest.java similarity index 99% rename from remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/EpollRemoteConnectionTest.java rename to remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/EpollRemotingConnectionTest.java index 0f4106f..428ed18 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/EpollRemoteConnectionTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/EpollRemotingConnectionTest.java @@ -38,7 +38,7 @@ import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -public class EpollRemoteConnectionTest extends BaseTest { +public class EpollRemotingConnectionTest extends BaseTest { private static RemotingServer remotingServer; private static RemotingClient remotingClient; diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstractTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstractTest.java index c9332b4..510dfa3 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstractTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingAbstractTest.java @@ -35,8 +35,8 @@ import org.apache.rocketmq.remoting.api.RequestProcessor; import org.apache.rocketmq.remoting.api.channel.ChannelEventListener; import org.apache.rocketmq.remoting.api.channel.RemotingChannel; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.api.exception.RemoteAccessException; -import org.apache.rocketmq.remoting.api.exception.RemoteTimeoutException; +import org.apache.rocketmq.remoting.api.exception.RemotingAccessException; +import org.apache.rocketmq.remoting.api.exception.RemotingTimeoutException; import org.apache.rocketmq.remoting.api.exception.SemaphoreExhaustedException; import org.apache.rocketmq.remoting.api.interceptor.Interceptor; import org.apache.rocketmq.remoting.api.interceptor.RequestContext; @@ -260,7 +260,7 @@ public class NettyRemotingAbstractTest extends BaseTest { TimeUnit.MILLISECONDS.sleep(15); remotingAbstract.scanResponseTable(); - assertThat(objectFuture.getObject()).isInstanceOf(RemoteTimeoutException.class); + assertThat(objectFuture.getObject()).isInstanceOf(RemotingTimeoutException.class); } @Test @@ -278,9 +278,9 @@ public class NettyRemotingAbstractTest extends BaseTest { try { RemotingCommand response = remotingAbstract.invokeWithInterceptor(clientChannel, remotingRequest, 10); - failBecauseExceptionWasNotThrown(RemoteTimeoutException.class); + failBecauseExceptionWasNotThrown(RemotingTimeoutException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteTimeoutException.class); + assertThat(e).isInstanceOf(RemotingTimeoutException.class); } } @@ -293,10 +293,10 @@ public class NettyRemotingAbstractTest extends BaseTest { try { RemotingCommand response = remotingAbstract.invokeWithInterceptor(mockedClientChannel, remotingRequest, 10); - failBecauseExceptionWasNotThrown(RemoteAccessException.class); + failBecauseExceptionWasNotThrown(RemotingAccessException.class); } catch (Exception e) { assertThat(e.getCause()).isInstanceOf(UnitTestException.class); - assertThat(e).isInstanceOf(RemoteAccessException.class); + assertThat(e).isInstanceOf(RemotingAccessException.class); } } diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClientTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClientTest.java index aee21fb..9ff1c22 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClientTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingClientTest.java @@ -21,8 +21,8 @@ import io.netty.channel.Channel; import org.apache.rocketmq.remoting.BaseTest; import org.apache.rocketmq.remoting.api.AsyncHandler; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.api.exception.RemoteConnectFailureException; -import org.apache.rocketmq.remoting.api.exception.RemoteTimeoutException; +import org.apache.rocketmq.remoting.api.exception.RemotingConnectFailureException; +import org.apache.rocketmq.remoting.api.exception.RemotingTimeoutException; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -88,9 +88,9 @@ public class NettyRemotingClientTest extends BaseTest { try { RemotingCommand returnedResp = remotingClient.invoke("127.0.0.1:10911", request, 3000); - failBecauseExceptionWasNotThrown(RemoteConnectFailureException.class); + failBecauseExceptionWasNotThrown(RemotingConnectFailureException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteConnectFailureException.class); + assertThat(e).isInstanceOf(RemotingConnectFailureException.class); } } @@ -98,13 +98,13 @@ public class NettyRemotingClientTest extends BaseTest { public void invoke_TimeoutException() { RemotingCommand request = remotingClient.commandFactory().createRequest(); - doThrow(new RemoteTimeoutException("Timeout exception occurred")).when(remotingClient).invokeWithInterceptor(mockedChannel, request, 3000); + doThrow(new RemotingTimeoutException("Timeout exception occurred")).when(remotingClient).invokeWithInterceptor(mockedChannel, request, 3000); try { RemotingCommand returnedResp = remotingClient.invoke("127.0.0.1:10911", request, 3000); - failBecauseExceptionWasNotThrown(RemoteTimeoutException.class); + failBecauseExceptionWasNotThrown(RemotingTimeoutException.class); } catch (Exception e) { - assertThat(e).isInstanceOf(RemoteTimeoutException.class); + assertThat(e).isInstanceOf(RemotingTimeoutException.class); } } diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemoteConnectionTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingConnectionTest.java similarity index 99% rename from remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemoteConnectionTest.java rename to remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingConnectionTest.java index d12a5a3..2ba88d8 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemoteConnectionTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/NettyRemotingConnectionTest.java @@ -37,7 +37,7 @@ import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -public class NettyRemoteConnectionTest extends BaseTest { +public class NettyRemotingConnectionTest extends BaseTest { private static RemotingServer remotingServer; private static RemotingClient remotingClient; diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/EncoderTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/EncoderTest.java index 1629342..11fff1b 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/EncoderTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/EncoderTest.java @@ -23,7 +23,7 @@ import java.nio.channels.ClosedChannelException; import org.apache.commons.lang3.RandomStringUtils; import org.apache.rocketmq.remoting.BaseTest; import org.apache.rocketmq.remoting.api.command.RemotingCommand; -import org.apache.rocketmq.remoting.impl.buffer.NettyByteBufferWrapper; +import org.apache.rocketmq.remoting.impl.buffer.NettyRemotingBuffer; import org.apache.rocketmq.remoting.impl.command.CodecHelper; import org.junit.Test; @@ -47,7 +47,7 @@ public class EncoderTest extends BaseTest { assertEquals(PROTOCOL_MAGIC, buffer.readByte()); buffer.readInt(); - RemotingCommand decodedRequest = CodecHelper.decode(new NettyByteBufferWrapper(buffer)); + RemotingCommand decodedRequest = CodecHelper.decode(new NettyRemotingBuffer(buffer)); assertEquals(request, decodedRequest); } diff --git a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/ExceptionHandlerTest.java b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/ExceptionHandlerTest.java index 2a27c8b..5a3e508 100644 --- a/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/ExceptionHandlerTest.java +++ b/remoting-core/remoting-impl/src/test/java/org/apache/rocketmq/remoting/impl/netty/handler/ExceptionHandlerTest.java @@ -26,7 +26,7 @@ import java.nio.channels.ClosedChannelException; import java.util.List; import org.apache.commons.lang3.NotImplementedException; import org.apache.rocketmq.remoting.BaseTest; -import org.apache.rocketmq.remoting.impl.buffer.NettyByteBufferWrapper; +import org.apache.rocketmq.remoting.impl.buffer.NettyRemotingBuffer; import org.apache.rocketmq.remoting.impl.command.CodecHelper; import org.junit.Test; @@ -48,7 +48,7 @@ public class ExceptionHandlerTest extends BaseTest { } }, new ExceptionHandler()); - CodecHelper.encodeCommand(randomRemotingCommand(), new NettyByteBufferWrapper(buffer)); + CodecHelper.encodeCommand(randomRemotingCommand(), new NettyRemotingBuffer(buffer)); channel.writeInbound(buffer); try {
