Remove public modifier in dubbo-remoting (#10981)
This commit is contained in:
parent
45120670ba
commit
143d61d3e2
|
|
@ -33,7 +33,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
|
|||
* <p>
|
||||
* mvn clean test -Dtest=*PerformanceClientTest -Dserver=10.20.153.187:9911
|
||||
*/
|
||||
public class ChanelHandlerTest {
|
||||
class ChanelHandlerTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ChanelHandlerTest.class);
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class ChanelHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClient() throws Throwable {
|
||||
void testClient() throws Throwable {
|
||||
// read server info from property
|
||||
if (PerformanceUtils.getProperty("server", null) == null) {
|
||||
logger.warn("Please set -Dserver=127.0.0.1:9911");
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
|
|||
* ProformanceClient
|
||||
* The test class will report abnormal thread pool, because the judgment on the thread pool concurrency problems produced in DefaultChannelHandler (connected event has been executed asynchronously, judgment, then closed the thread pool, thread pool and execution error, this problem can be specified through the Constants.CHANNEL_HANDLER_KEY=connection.)
|
||||
*/
|
||||
public class PerformanceClientCloseTest {
|
||||
class PerformanceClientCloseTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PerformanceClientCloseTest.class);
|
||||
|
||||
@Test
|
||||
public void testClient() throws Throwable {
|
||||
void testClient() throws Throwable {
|
||||
// read server info from property
|
||||
if (PerformanceUtils.getProperty("server", null) == null) {
|
||||
logger.warn("Please set -Dserver=127.0.0.1:9911");
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
|
||||
import static org.apache.dubbo.remoting.Constants.CONNECTIONS_KEY;
|
||||
|
||||
public class PerformanceClientFixedTest {
|
||||
class PerformanceClientFixedTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PerformanceClientTest.class);
|
||||
|
||||
@Test
|
||||
public void testClient() throws Exception {
|
||||
void testClient() throws Exception {
|
||||
// read the parameters
|
||||
if (PerformanceUtils.getProperty("server", null) == null) {
|
||||
logger.warn("Please set -Dserver=127.0.0.1:9911");
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import static org.apache.dubbo.remoting.Constants.CONNECTIONS_KEY;
|
|||
* <p>
|
||||
* mvn clean test -Dtest=*PerformanceClientTest -Dserver=10.20.153.187:9911
|
||||
*/
|
||||
public class PerformanceClientTest {
|
||||
class PerformanceClientTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PerformanceClientTest.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import static org.apache.dubbo.remoting.Constants.DEFAULT_BUFFER_SIZE;
|
|||
* <p>
|
||||
* mvn clean test -Dtest=*PerformanceServerTest -Dport=9911
|
||||
*/
|
||||
public class PerformanceServerTest {
|
||||
class PerformanceServerTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PerformanceServerTest.class);
|
||||
private static ExchangeServer server = null;
|
||||
|
|
@ -148,7 +148,7 @@ public class PerformanceServerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testServer() throws Exception {
|
||||
void testServer() throws Exception {
|
||||
// Read port from property
|
||||
if (PerformanceUtils.getProperty("port", null) == null) {
|
||||
logger.warn("Please set -Dport=9911");
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class TransportersTest {
|
||||
class TransportersTest {
|
||||
private String url = "dubbo://127.0.0.1:12345?transporter=mockTransporter";
|
||||
private ChannelHandler channel = Mockito.mock(ChannelHandler.class);
|
||||
|
||||
@Test
|
||||
public void testBind() throws RemotingException {
|
||||
void testBind() throws RemotingException {
|
||||
Assertions.assertThrows(RuntimeException.class, () -> Transporters.bind((String) null));
|
||||
Assertions.assertThrows(RuntimeException.class, () -> Transporters.bind((URL) null));
|
||||
Assertions.assertThrows(RuntimeException.class, () -> Transporters.bind(url));
|
||||
|
|
@ -36,7 +36,7 @@ public class TransportersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConnect() throws RemotingException {
|
||||
void testConnect() throws RemotingException {
|
||||
Assertions.assertThrows(RuntimeException.class, () -> Transporters.connect((String) null));
|
||||
Assertions.assertThrows(RuntimeException.class, () -> Transporters.connect((URL) null));
|
||||
Assertions.assertNotNull(Transporters.connect(url));
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.util.concurrent.CountDownLatch;
|
|||
class ConnectionTest {
|
||||
|
||||
@Test
|
||||
public void testRefCnt0() throws InterruptedException {
|
||||
void testRefCnt0() throws InterruptedException {
|
||||
Connection connection = new Connection(URL.valueOf("empty://127.0.0.1:8080?foo=bar"));
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
connection.getClosePromise().addListener(future -> latch.countDown());
|
||||
|
|
@ -36,7 +36,7 @@ class ConnectionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRefCnt1() {
|
||||
void testRefCnt1() {
|
||||
Connection connection = new Connection(URL.valueOf("empty://127.0.0.1:8080?foo=bar"));
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
connection.retain();
|
||||
|
|
@ -46,7 +46,7 @@ class ConnectionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRefCnt2() throws InterruptedException {
|
||||
void testRefCnt2() throws InterruptedException {
|
||||
Connection connection = new Connection(URL.valueOf("empty://127.0.0.1:8080?foo=bar"));
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
connection.retain();
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ import java.lang.reflect.Field;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class MultiplexProtocolConnectionManagerTest {
|
||||
class MultiplexProtocolConnectionManagerTest {
|
||||
private ConnectionManager connectionManager = ExtensionLoader.getExtensionLoader(ConnectionManager.class).getExtension(MultiplexProtocolConnectionManager.NAME);
|
||||
|
||||
@Test
|
||||
public void testConnect() throws Exception {
|
||||
void testConnect() throws Exception {
|
||||
URL url = URL.valueOf("empty://127.0.0.1:8080?foo=bar");
|
||||
Connection connection = connectionManager.connect(url);
|
||||
Assertions.assertNotNull(connection);
|
||||
|
|
@ -45,7 +45,7 @@ public class MultiplexProtocolConnectionManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testForEachConnection() throws RemotingException {
|
||||
void testForEachConnection() throws RemotingException {
|
||||
URL url = URL.valueOf("empty://127.0.0.1:8080?foo=bar");
|
||||
Connection connect1 = connectionManager.connect(url);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import static org.apache.dubbo.remoting.Constants.NETTY_EPOLL_ENABLE_KEY;
|
|||
/**
|
||||
* {@link NettyEventLoopFactory}
|
||||
*/
|
||||
public class NettyEventLoopFactoryTest {
|
||||
class NettyEventLoopFactoryTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ import java.lang.reflect.Field;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class SingleProtocolConnectionManagerTest {
|
||||
class SingleProtocolConnectionManagerTest {
|
||||
|
||||
private ConnectionManager connectionManager = ExtensionLoader.getExtensionLoader(ConnectionManager.class).getExtension(SingleProtocolConnectionManager.NAME);
|
||||
|
||||
@Test
|
||||
public void testConnect() throws Exception {
|
||||
void testConnect() throws Exception {
|
||||
URL url = URL.valueOf("empty://127.0.0.1:8080?foo=bar");
|
||||
Connection connection = connectionManager.connect(url);
|
||||
Assertions.assertNotNull(connection);
|
||||
|
|
@ -51,7 +51,7 @@ public class SingleProtocolConnectionManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testForEachConnection() throws RemotingException {
|
||||
void testForEachConnection() throws RemotingException {
|
||||
URL url = URL.valueOf("empty://127.0.0.1:8080?foo=bar");
|
||||
Connection connection = connectionManager.connect(url);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,13 +66,13 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void initialState() {
|
||||
void initialState() {
|
||||
assertEquals(CAPACITY, buffer.capacity());
|
||||
assertEquals(0, buffer.readerIndex());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readerIndexBoundaryCheck1() {
|
||||
void readerIndexBoundaryCheck1() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
try {
|
||||
buffer.writerIndex(0);
|
||||
|
|
@ -84,7 +84,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void readerIndexBoundaryCheck2() {
|
||||
void readerIndexBoundaryCheck2() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
try {
|
||||
buffer.writerIndex(buffer.capacity());
|
||||
|
|
@ -96,7 +96,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void readerIndexBoundaryCheck3() {
|
||||
void readerIndexBoundaryCheck3() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
try {
|
||||
buffer.writerIndex(CAPACITY / 2);
|
||||
|
|
@ -108,7 +108,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void readerIndexBoundaryCheck4() {
|
||||
void readerIndexBoundaryCheck4() {
|
||||
buffer.writerIndex(0);
|
||||
buffer.readerIndex(0);
|
||||
buffer.writerIndex(buffer.capacity());
|
||||
|
|
@ -116,14 +116,14 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void writerIndexBoundaryCheck1() {
|
||||
void writerIndexBoundaryCheck1() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
buffer.writerIndex(-1);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void writerIndexBoundaryCheck2() {
|
||||
void writerIndexBoundaryCheck2() {
|
||||
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
try {
|
||||
|
|
@ -137,7 +137,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void writerIndexBoundaryCheck3() {
|
||||
void writerIndexBoundaryCheck3() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
try {
|
||||
buffer.writerIndex(CAPACITY);
|
||||
|
|
@ -150,74 +150,74 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void writerIndexBoundaryCheck4() {
|
||||
void writerIndexBoundaryCheck4() {
|
||||
buffer.writerIndex(0);
|
||||
buffer.readerIndex(0);
|
||||
buffer.writerIndex(CAPACITY);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByteBoundaryCheck1() {
|
||||
void getByteBoundaryCheck1() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getByte(-1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByteBoundaryCheck2() {
|
||||
void getByteBoundaryCheck2() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getByte(buffer.capacity()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByteArrayBoundaryCheck1() {
|
||||
void getByteArrayBoundaryCheck1() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, new byte[0]));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByteArrayBoundaryCheck2() {
|
||||
void getByteArrayBoundaryCheck2() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, new byte[0], 0, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByteBufferBoundaryCheck() {
|
||||
void getByteBufferBoundaryCheck() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, ByteBuffer.allocate(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyBoundaryCheck1() {
|
||||
void copyBoundaryCheck1() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(-1, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyBoundaryCheck2() {
|
||||
void copyBoundaryCheck2() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(0, buffer.capacity() + 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyBoundaryCheck3() {
|
||||
void copyBoundaryCheck3() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(buffer.capacity() + 1, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyBoundaryCheck4() {
|
||||
void copyBoundaryCheck4() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(buffer.capacity(), 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setIndexBoundaryCheck1() {
|
||||
void setIndexBoundaryCheck1() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.setIndex(-1, CAPACITY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setIndexBoundaryCheck2() {
|
||||
void setIndexBoundaryCheck2() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.setIndex(CAPACITY / 2, CAPACITY / 4));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setIndexBoundaryCheck3() {
|
||||
void setIndexBoundaryCheck3() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.setIndex(0, CAPACITY + 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByteBufferState() {
|
||||
void getByteBufferState() {
|
||||
ByteBuffer dst = ByteBuffer.allocate(4);
|
||||
dst.position(1);
|
||||
dst.limit(3);
|
||||
|
|
@ -239,12 +239,12 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getDirectByteBufferBoundaryCheck() {
|
||||
void getDirectByteBufferBoundaryCheck() {
|
||||
Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, ByteBuffer.allocateDirect(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDirectByteBufferState() {
|
||||
void getDirectByteBufferState() {
|
||||
ByteBuffer dst = ByteBuffer.allocateDirect(4);
|
||||
dst.position(1);
|
||||
dst.limit(3);
|
||||
|
|
@ -266,7 +266,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRandomByteAccess() {
|
||||
void testRandomByteAccess() {
|
||||
for (int i = 0; i < buffer.capacity(); i++) {
|
||||
byte value = (byte) random.nextInt();
|
||||
buffer.setByte(i, value);
|
||||
|
|
@ -280,7 +280,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialByteAccess() {
|
||||
void testSequentialByteAccess() {
|
||||
buffer.writerIndex(0);
|
||||
for (int i = 0; i < buffer.capacity(); i++) {
|
||||
byte value = (byte) random.nextInt();
|
||||
|
|
@ -308,7 +308,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testByteArrayTransfer() {
|
||||
void testByteArrayTransfer() {
|
||||
byte[] value = new byte[BLOCK_SIZE * 2];
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
random.nextBytes(value);
|
||||
|
|
@ -328,7 +328,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRandomByteArrayTransfer1() {
|
||||
void testRandomByteArrayTransfer1() {
|
||||
byte[] value = new byte[BLOCK_SIZE];
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
random.nextBytes(value);
|
||||
|
|
@ -348,7 +348,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRandomByteArrayTransfer2() {
|
||||
void testRandomByteArrayTransfer2() {
|
||||
byte[] value = new byte[BLOCK_SIZE * 2];
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
random.nextBytes(value);
|
||||
|
|
@ -369,7 +369,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRandomHeapBufferTransfer1() {
|
||||
void testRandomHeapBufferTransfer1() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE];
|
||||
ChannelBuffer value = wrappedBuffer(valueContent);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
|
|
@ -396,7 +396,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRandomHeapBufferTransfer2() {
|
||||
void testRandomHeapBufferTransfer2() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = wrappedBuffer(valueContent);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
|
|
@ -418,7 +418,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRandomDirectBufferTransfer() {
|
||||
void testRandomDirectBufferTransfer() {
|
||||
byte[] tmp = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = directBuffer(BLOCK_SIZE * 2);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
|
|
@ -441,7 +441,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRandomByteBufferTransfer() {
|
||||
void testRandomByteBufferTransfer() {
|
||||
ByteBuffer value = ByteBuffer.allocate(BLOCK_SIZE * 2);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
random.nextBytes(value.array());
|
||||
|
|
@ -465,7 +465,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialByteArrayTransfer1() {
|
||||
void testSequentialByteArrayTransfer1() {
|
||||
byte[] value = new byte[BLOCK_SIZE];
|
||||
buffer.writerIndex(0);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
|
|
@ -489,7 +489,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialByteArrayTransfer2() {
|
||||
void testSequentialByteArrayTransfer2() {
|
||||
byte[] value = new byte[BLOCK_SIZE * 2];
|
||||
buffer.writerIndex(0);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
|
|
@ -515,7 +515,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialHeapBufferTransfer1() {
|
||||
void testSequentialHeapBufferTransfer1() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = wrappedBuffer(valueContent);
|
||||
buffer.writerIndex(0);
|
||||
|
|
@ -546,7 +546,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialHeapBufferTransfer2() {
|
||||
void testSequentialHeapBufferTransfer2() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = wrappedBuffer(valueContent);
|
||||
buffer.writerIndex(0);
|
||||
|
|
@ -582,7 +582,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialDirectBufferTransfer1() {
|
||||
void testSequentialDirectBufferTransfer1() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = directBuffer(BLOCK_SIZE * 2);
|
||||
buffer.writerIndex(0);
|
||||
|
|
@ -615,7 +615,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialDirectBufferTransfer2() {
|
||||
void testSequentialDirectBufferTransfer2() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = directBuffer(BLOCK_SIZE * 2);
|
||||
buffer.writerIndex(0);
|
||||
|
|
@ -654,7 +654,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialByteBufferBackedHeapBufferTransfer1() {
|
||||
void testSequentialByteBufferBackedHeapBufferTransfer1() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = wrappedBuffer(ByteBuffer.allocate(BLOCK_SIZE * 2));
|
||||
value.writerIndex(0);
|
||||
|
|
@ -688,7 +688,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialByteBufferBackedHeapBufferTransfer2() {
|
||||
void testSequentialByteBufferBackedHeapBufferTransfer2() {
|
||||
byte[] valueContent = new byte[BLOCK_SIZE * 2];
|
||||
ChannelBuffer value = wrappedBuffer(ByteBuffer.allocate(BLOCK_SIZE * 2));
|
||||
value.writerIndex(0);
|
||||
|
|
@ -728,7 +728,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialByteBufferTransfer() {
|
||||
void testSequentialByteBufferTransfer() {
|
||||
buffer.writerIndex(0);
|
||||
ByteBuffer value = ByteBuffer.allocate(BLOCK_SIZE * 2);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
|
|
@ -753,7 +753,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialCopiedBufferTransfer1() {
|
||||
void testSequentialCopiedBufferTransfer1() {
|
||||
buffer.writerIndex(0);
|
||||
for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) {
|
||||
byte[] value = new byte[BLOCK_SIZE];
|
||||
|
|
@ -779,7 +779,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStreamTransfer1() throws Exception {
|
||||
void testStreamTransfer1() throws Exception {
|
||||
byte[] expected = new byte[buffer.capacity()];
|
||||
random.nextBytes(expected);
|
||||
|
||||
|
|
@ -798,7 +798,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStreamTransfer2() throws Exception {
|
||||
void testStreamTransfer2() throws Exception {
|
||||
byte[] expected = new byte[buffer.capacity()];
|
||||
random.nextBytes(expected);
|
||||
buffer.clear();
|
||||
|
|
@ -821,7 +821,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCopy() {
|
||||
void testCopy() {
|
||||
for (int i = 0; i < buffer.capacity(); i++) {
|
||||
byte value = (byte) random.nextInt();
|
||||
buffer.setByte(i, value);
|
||||
|
|
@ -848,7 +848,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testToByteBuffer1() {
|
||||
void testToByteBuffer1() {
|
||||
byte[] value = new byte[buffer.capacity()];
|
||||
random.nextBytes(value);
|
||||
buffer.clear();
|
||||
|
|
@ -858,7 +858,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testToByteBuffer2() {
|
||||
void testToByteBuffer2() {
|
||||
byte[] value = new byte[buffer.capacity()];
|
||||
random.nextBytes(value);
|
||||
buffer.clear();
|
||||
|
|
@ -870,7 +870,7 @@ public abstract class AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSkipBytes1() {
|
||||
void testSkipBytes1() {
|
||||
buffer.setIndex(CAPACITY / 4, CAPACITY / 2);
|
||||
|
||||
buffer.skipBytes(CAPACITY / 4);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.apache.dubbo.remoting.buffer;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class ByteBufferBackedChannelBufferTest extends AbstractChannelBufferTest {
|
||||
class ByteBufferBackedChannelBufferTest extends AbstractChannelBufferTest {
|
||||
|
||||
private ChannelBuffer buffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ import java.nio.ByteBuffer;
|
|||
* {@link DirectChannelBufferFactory}
|
||||
* {@link HeapChannelBufferFactory}
|
||||
*/
|
||||
public class ChannelBufferFactoryTest {
|
||||
class ChannelBufferFactoryTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
ChannelBufferFactory directChannelBufferFactory = DirectChannelBufferFactory.getInstance();
|
||||
ChannelBufferFactory heapChannelBufferFactory = HeapChannelBufferFactory.getInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,30 +27,30 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class ChannelBufferStreamTest {
|
||||
class ChannelBufferStreamTest {
|
||||
|
||||
@Test
|
||||
public void testChannelBufferOutputStreamWithNull() {
|
||||
void testChannelBufferOutputStreamWithNull() {
|
||||
assertThrows(NullPointerException.class, () -> new ChannelBufferOutputStream(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelBufferInputStreamWithNull() {
|
||||
void testChannelBufferInputStreamWithNull() {
|
||||
assertThrows(NullPointerException.class, () -> new ChannelBufferInputStream(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelBufferInputStreamWithNullAndLength() {
|
||||
void testChannelBufferInputStreamWithNullAndLength() {
|
||||
assertThrows(NullPointerException.class, () -> new ChannelBufferInputStream(null, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelBufferInputStreamWithBadLength() {
|
||||
void testChannelBufferInputStreamWithBadLength() {
|
||||
assertThrows(IllegalArgumentException.class, () -> new ChannelBufferInputStream(mock(ChannelBuffer.class), -1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelBufferInputStreamWithOutOfBounds() {
|
||||
void testChannelBufferInputStreamWithOutOfBounds() {
|
||||
assertThrows(IndexOutOfBoundsException.class, () -> {
|
||||
ChannelBuffer buf = mock(ChannelBuffer.class);
|
||||
new ChannelBufferInputStream(buf, buf.capacity() + 1);
|
||||
|
|
@ -58,7 +58,7 @@ public class ChannelBufferStreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testChannelBufferWriteOutAndReadIn() {
|
||||
void testChannelBufferWriteOutAndReadIn() {
|
||||
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
|
||||
testChannelBufferOutputStream(buf);
|
||||
testChannelBufferInputStream(buf);
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ import static org.apache.dubbo.remoting.buffer.ChannelBuffers.EMPTY_BUFFER;
|
|||
/**
|
||||
* {@link ChannelBuffers}
|
||||
*/
|
||||
public class ChannelBuffersTest {
|
||||
class ChannelBuffersTest {
|
||||
@Test
|
||||
public void testDynamicBuffer() {
|
||||
void testDynamicBuffer() {
|
||||
ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer();
|
||||
Assertions.assertTrue(channelBuffer instanceof DynamicChannelBuffer);
|
||||
Assertions.assertEquals(channelBuffer.capacity(), DEFAULT_CAPACITY);
|
||||
|
|
@ -41,7 +41,7 @@ public class ChannelBuffersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPrefixEquals(){
|
||||
void testPrefixEquals(){
|
||||
ChannelBuffer bufA = ChannelBuffers.wrappedBuffer("abcedfaf".getBytes());
|
||||
ChannelBuffer bufB = ChannelBuffers.wrappedBuffer("abcedfaa".getBytes());
|
||||
Assertions.assertTrue(ChannelBuffers.equals(bufA, bufB));
|
||||
|
|
@ -50,7 +50,7 @@ public class ChannelBuffersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuffer() {
|
||||
void testBuffer() {
|
||||
ChannelBuffer channelBuffer = ChannelBuffers.buffer(DEFAULT_CAPACITY);
|
||||
Assertions.assertTrue(channelBuffer instanceof HeapChannelBuffer);
|
||||
channelBuffer = ChannelBuffers.buffer(0);
|
||||
|
|
@ -58,7 +58,7 @@ public class ChannelBuffersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWrappedBuffer() {
|
||||
void testWrappedBuffer() {
|
||||
byte[] bytes = new byte[16];
|
||||
ChannelBuffer channelBuffer = ChannelBuffers.wrappedBuffer(bytes, 0, 15);
|
||||
Assertions.assertTrue(channelBuffer instanceof HeapChannelBuffer);
|
||||
|
|
@ -81,7 +81,7 @@ public class ChannelBuffersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDirectBuffer() {
|
||||
void testDirectBuffer() {
|
||||
ChannelBuffer channelBuffer = ChannelBuffers.directBuffer(0);
|
||||
Assertions.assertEquals(channelBuffer, EMPTY_BUFFER);
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ public class ChannelBuffersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsHashCodeCompareMethod() {
|
||||
void testEqualsHashCodeCompareMethod() {
|
||||
ChannelBuffer buffer1 = ChannelBuffers.buffer(4);
|
||||
byte[] bytes1 = new byte[]{1, 2, 3, 4};
|
||||
buffer1.writeBytes(bytes1);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.apache.dubbo.remoting.buffer;
|
|||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
public class DirectChannelBufferTest extends AbstractChannelBufferTest {
|
||||
class DirectChannelBufferTest extends AbstractChannelBufferTest {
|
||||
|
||||
private ChannelBuffer buffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.Random;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class DynamicChannelBufferTest extends AbstractChannelBufferTest {
|
||||
class DynamicChannelBufferTest extends AbstractChannelBufferTest {
|
||||
|
||||
private ChannelBuffer buffer;
|
||||
|
||||
|
|
@ -44,24 +44,24 @@ public class DynamicChannelBufferTest extends AbstractChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotFailOnInitialIndexUpdate() {
|
||||
void shouldNotFailOnInitialIndexUpdate() {
|
||||
new DynamicChannelBuffer(10).setIndex(0, 10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotFailOnInitialIndexUpdate2() {
|
||||
void shouldNotFailOnInitialIndexUpdate2() {
|
||||
new DynamicChannelBuffer(10).writerIndex(10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotFailOnInitialIndexUpdate3() {
|
||||
void shouldNotFailOnInitialIndexUpdate3() {
|
||||
ChannelBuffer buf = new DynamicChannelBuffer(10);
|
||||
buf.writerIndex(10);
|
||||
buf.readerIndex(10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ensureWritableBytes() {
|
||||
void ensureWritableBytes() {
|
||||
ChannelBuffer buf = new DynamicChannelBuffer(16);
|
||||
buf.ensureWritableBytes(30);
|
||||
Assertions.assertEquals(buf.capacity(), 32);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
|
|||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
|
||||
public class HeapChannelBufferTest extends AbstractChannelBufferTest {
|
||||
class HeapChannelBufferTest extends AbstractChannelBufferTest {
|
||||
|
||||
private ChannelBuffer buffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.READONLY_EVENT;
|
||||
import static org.apache.dubbo.common.serialize.Constants.FASTJSON2_SERIALIZATION_ID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -128,7 +127,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Error_MagicNum() throws IOException {
|
||||
void test_Decode_Error_MagicNum() throws IOException {
|
||||
HashMap<byte[], Object> inputBytes = new HashMap<byte[], Object>();
|
||||
inputBytes.put(new byte[]{0}, TelnetCodec.DecodeResult.NEED_MORE_INPUT);
|
||||
inputBytes.put(new byte[]{MAGIC_HIGH, 0}, TelnetCodec.DecodeResult.NEED_MORE_INPUT);
|
||||
|
|
@ -140,7 +139,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Error_Length() throws IOException {
|
||||
void test_Decode_Error_Length() throws IOException {
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
byte[] request = getRequestBytes(person, header);
|
||||
|
|
@ -155,7 +154,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Error_Response_Object() throws IOException {
|
||||
void test_Decode_Error_Response_Object() throws IOException {
|
||||
//00000010-response/oneway/hearbeat=true |20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
|
|
@ -169,7 +168,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidSerializaitonId() throws Exception {
|
||||
void testInvalidSerializaitonId() throws Exception {
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte)0x8F, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Object obj = decode(header);
|
||||
Assertions.assertTrue(obj instanceof Request);
|
||||
|
|
@ -186,7 +185,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Check_Payload() throws IOException {
|
||||
void test_Decode_Check_Payload() throws IOException {
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
byte[] request = assemblyDataProtocol(header);
|
||||
|
||||
|
|
@ -205,19 +204,19 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Header_Need_Readmore() throws IOException {
|
||||
void test_Decode_Header_Need_Readmore() throws IOException {
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
testDecode_assertEquals(header, TelnetCodec.DecodeResult.NEED_MORE_INPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Body_Need_Readmore() throws IOException {
|
||||
void test_Decode_Body_Need_Readmore() throws IOException {
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 'a', 'a'};
|
||||
testDecode_assertEquals(header, TelnetCodec.DecodeResult.NEED_MORE_INPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_MigicCodec_Contain_ExchangeHeader() throws IOException {
|
||||
void test_Decode_MigicCodec_Contain_ExchangeHeader() throws IOException {
|
||||
byte[] header = new byte[]{0, 0, MAGIC_HIGH, MAGIC_LOW, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
Channel channel = getServerSideChannel(url);
|
||||
|
|
@ -229,7 +228,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Return_Response_Person() throws IOException {
|
||||
void test_Decode_Return_Response_Person() throws IOException {
|
||||
//00000010-response/oneway/hearbeat=false/hessian |20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
|
|
@ -252,7 +251,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Return_Request_Event_Object() throws IOException {
|
||||
void test_Decode_Return_Request_Event_Object() throws IOException {
|
||||
//|10011111|20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
|
|
@ -269,7 +268,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Return_Request_Event_String() throws IOException {
|
||||
void test_Decode_Return_Request_Event_String() throws IOException {
|
||||
//|10011111|20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
String event = READONLY_EVENT;
|
||||
|
|
@ -284,7 +283,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Return_Request_Heartbeat_Object() throws IOException {
|
||||
void test_Decode_Return_Request_Heartbeat_Object() throws IOException {
|
||||
//|10011111|20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
byte[] request = getRequestBytes(null, header);
|
||||
|
|
@ -297,7 +296,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Return_Request_Object() throws IOException {
|
||||
void test_Decode_Return_Request_Object() throws IOException {
|
||||
//|10011111|20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
|
|
@ -314,7 +313,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Decode_Error_Request_Object() throws IOException {
|
||||
void test_Decode_Error_Request_Object() throws IOException {
|
||||
//00000010-response/oneway/hearbeat=true |20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
|
|
@ -329,7 +328,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Header_Response_NoSerializationFlag() throws IOException {
|
||||
void test_Header_Response_NoSerializationFlag() throws IOException {
|
||||
//00000010-response/oneway/hearbeat=false/noset |20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
|
|
@ -342,7 +341,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Header_Response_Heartbeat() throws IOException {
|
||||
void test_Header_Response_Heartbeat() throws IOException {
|
||||
//00000010-response/oneway/hearbeat=true |20-stats=ok|id=0|length=0
|
||||
byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
Person person = new Person();
|
||||
|
|
@ -355,7 +354,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Encode_Request() throws IOException {
|
||||
void test_Encode_Request() throws IOException {
|
||||
ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(2014);
|
||||
Channel channel = getClientSideChannel(url);
|
||||
Request request = new Request();
|
||||
|
|
@ -376,7 +375,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Encode_Response() throws IOException {
|
||||
void test_Encode_Response() throws IOException {
|
||||
ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(1024);
|
||||
Channel channel = getClientSideChannel(url);
|
||||
Response response = new Response();
|
||||
|
|
@ -405,7 +404,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Encode_Error_Response() throws IOException {
|
||||
void test_Encode_Error_Response() throws IOException {
|
||||
ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(1024);
|
||||
Channel channel = getClientSideChannel(url);
|
||||
Response response = new Response();
|
||||
|
|
@ -434,7 +433,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMessageLengthGreaterThanMessageActualLength() throws Exception {
|
||||
void testMessageLengthGreaterThanMessageActualLength() throws Exception {
|
||||
Channel channel = getClientSideChannel(url);
|
||||
Request request = new Request(1L);
|
||||
request.setVersion(Version.getProtocolVersion());
|
||||
|
|
@ -468,7 +467,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMessageLengthExceedPayloadLimitWhenEncode() throws Exception {
|
||||
void testMessageLengthExceedPayloadLimitWhenEncode() throws Exception {
|
||||
Request request = new Request(1L);
|
||||
request.setData("hello");
|
||||
ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(512);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import java.io.Serializable;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TelnetCodecTest {
|
||||
class TelnetCodecTest {
|
||||
protected Codec2 codec;
|
||||
byte[] UP = new byte[]{27, 91, 65};
|
||||
byte[] DOWN = new byte[]{27, 91, 66};
|
||||
|
|
@ -189,37 +189,37 @@ public class TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_String_ClientSide() throws IOException {
|
||||
void testDecode_String_ClientSide() throws IOException {
|
||||
testDecode_assertEquals("aaa".getBytes(), "aaa", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_BlankMessage() throws IOException {
|
||||
void testDecode_BlankMessage() throws IOException {
|
||||
testDecode_assertEquals(new byte[]{}, Codec2.DecodeResult.NEED_MORE_INPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_String_NoEnter() throws IOException {
|
||||
void testDecode_String_NoEnter() throws IOException {
|
||||
testDecode_assertEquals("aaa", Codec2.DecodeResult.NEED_MORE_INPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_String_WithEnter() throws IOException {
|
||||
void testDecode_String_WithEnter() throws IOException {
|
||||
testDecode_assertEquals("aaa\n", "aaa");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_String_MiddleWithEnter() throws IOException {
|
||||
void testDecode_String_MiddleWithEnter() throws IOException {
|
||||
testDecode_assertEquals("aaa\r\naaa", Codec2.DecodeResult.NEED_MORE_INPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_Person_ObjectOnly() throws IOException {
|
||||
void testDecode_Person_ObjectOnly() throws IOException {
|
||||
testDecode_assertEquals(new Person(), Codec2.DecodeResult.NEED_MORE_INPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_Person_WithEnter() throws IOException {
|
||||
void testDecode_Person_WithEnter() throws IOException {
|
||||
testDecode_PersonWithEnterByte(new byte[]{'\r', '\n'}, false);//windows end
|
||||
testDecode_PersonWithEnterByte(new byte[]{'\n', '\r'}, true);
|
||||
testDecode_PersonWithEnterByte(new byte[]{'\n'}, false); //linux end
|
||||
|
|
@ -228,7 +228,7 @@ public class TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_WithExitByte() throws IOException {
|
||||
void testDecode_WithExitByte() throws IOException {
|
||||
HashMap<byte[], Boolean> exitBytes = new HashMap<byte[], Boolean>();
|
||||
exitBytes.put(new byte[]{3}, true); /* Windows Ctrl+C */
|
||||
exitBytes.put(new byte[]{1, 3}, false); //must equal the bytes
|
||||
|
|
@ -242,7 +242,7 @@ public class TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_Backspace() throws IOException {
|
||||
void testDecode_Backspace() throws IOException {
|
||||
//32 8 first add space and then add backspace.
|
||||
testDecode_assertEquals(new byte[]{'\b'}, Codec2.DecodeResult.NEED_MORE_INPUT, new String(new byte[]{32, 8}));
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ public class TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_Backspace_WithError() throws IOException {
|
||||
void testDecode_Backspace_WithError() throws IOException {
|
||||
Assertions.assertThrows(IOException.class, () -> {
|
||||
url = url.addParameter(AbstractMockChannel.ERROR_WHEN_SEND, Boolean.TRUE.toString());
|
||||
testDecode_Backspace();
|
||||
|
|
@ -264,7 +264,7 @@ public class TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_History_UP() throws IOException {
|
||||
void testDecode_History_UP() throws IOException {
|
||||
//init channel
|
||||
AbstractMockChannel channel = getServerSideChannel(url);
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ public class TelnetCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_UPorDOWN_WithError() throws IOException {
|
||||
void testDecode_UPorDOWN_WithError() throws IOException {
|
||||
Assertions.assertThrows(IOException.class, () -> {
|
||||
url = url.addParameter(AbstractMockChannel.ERROR_WHEN_SEND, Boolean.TRUE.toString());
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ public class TelnetCodecTest {
|
|||
|
||||
//=============================================================================================================================
|
||||
@Test
|
||||
public void testEncode_String_ClientSide() throws IOException {
|
||||
void testEncode_String_ClientSide() throws IOException {
|
||||
testEecode_assertEquals("aaa", "aaa\r\n".getBytes(), false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class ExchangersTest {
|
||||
class ExchangersTest {
|
||||
|
||||
@Test
|
||||
public void testBind() throws RemotingException {
|
||||
void testBind() throws RemotingException {
|
||||
String url = "dubbo://127.0.0.1:12345?exchanger=mockExchanger";
|
||||
Exchangers.bind(url, Mockito.mock(Replier.class));
|
||||
Exchangers.bind(url, new ChannelHandlerAdapter(), Mockito.mock(Replier.class));
|
||||
|
|
@ -42,7 +42,7 @@ public class ExchangersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConnect() throws RemotingException {
|
||||
void testConnect() throws RemotingException {
|
||||
String url = "dubbo://127.0.0.1:12345?exchanger=mockExchanger";
|
||||
Exchangers.connect(url);
|
||||
Exchangers.connect(url, Mockito.mock(Replier.class));
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ package org.apache.dubbo.remoting.exchange;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RequestTest {
|
||||
class RequestTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Request request = new Request();
|
||||
request.setTwoWay(true);
|
||||
request.setBroken(true);
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT;
|
||||
|
||||
public class ResponseTest {
|
||||
class ResponseTest {
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Response response = new Response();
|
||||
response.setStatus(Response.OK);
|
||||
response.setId(1);
|
||||
|
|
|
|||
|
|
@ -35,18 +35,18 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class DefaultFutureTest {
|
||||
class DefaultFutureTest {
|
||||
|
||||
private static final AtomicInteger index = new AtomicInteger();
|
||||
|
||||
@Test
|
||||
public void newFuture() {
|
||||
void newFuture() {
|
||||
DefaultFuture future = defaultFuture(3000);
|
||||
Assertions.assertNotNull(future, "new future return null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDone() {
|
||||
void isDone() {
|
||||
DefaultFuture future = defaultFuture(3000);
|
||||
Assertions.assertTrue(!future.isDone(), "init future is finished!");
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ public class DefaultFutureTest {
|
|||
* after a future is timeout , time is : 2021-01-22 10:55:05
|
||||
*/
|
||||
@Test
|
||||
public void interruptSend() throws Exception {
|
||||
void interruptSend() throws Exception {
|
||||
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println("before a future is create , time is : " + LocalDateTime.now().format(formatter));
|
||||
// timeout after 1 seconds.
|
||||
|
|
@ -159,7 +159,7 @@ public class DefaultFutureTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClose() throws Exception {
|
||||
void testClose() throws Exception {
|
||||
Channel channel = new MockedChannel();
|
||||
Request request = new Request(123);
|
||||
ExecutorService executor = ExtensionLoader.getExtensionLoader(ExecutorRepository.class)
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ import org.mockito.Mockito;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class ExchangeHandlerDispatcherTest {
|
||||
class ExchangeHandlerDispatcherTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
void test() throws Exception {
|
||||
ExchangeHandlerDispatcher exchangeHandlerDispatcher = new ExchangeHandlerDispatcher();
|
||||
|
||||
ChannelHandler channelHandler = Mockito.mock(ChannelHandler.class);
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ import java.util.Iterator;
|
|||
/**
|
||||
* {@link MultiMessage}
|
||||
*/
|
||||
public class MultiMessageTest {
|
||||
class MultiMessageTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
MultiMessage multiMessage = MultiMessage.create();
|
||||
Assertions.assertTrue(multiMessage instanceof Iterable);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK;
|
|||
/**
|
||||
* {@link CloseTimerTask}
|
||||
*/
|
||||
public class CloseTimerTaskTest {
|
||||
class CloseTimerTaskTest {
|
||||
|
||||
private URL url = URL.valueOf("dubbo://localhost:20880");
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ public class CloseTimerTaskTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClose() throws Exception {
|
||||
void testClose() throws Exception {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
url = url.addParameter(DUBBO_VERSION_KEY, "2.1.1");
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import static org.mockito.Mockito.times;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class HeaderExchangeChannelTest {
|
||||
class HeaderExchangeChannelTest {
|
||||
|
||||
private HeaderExchangeChannel header;
|
||||
private MockChannel channel;
|
||||
|
|
@ -54,14 +54,14 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getOrAddChannelTest00() {
|
||||
void getOrAddChannelTest00() {
|
||||
channel.setAttribute("CHANNEL_KEY", "attribute");
|
||||
HeaderExchangeChannel ret = HeaderExchangeChannel.getOrAddChannel(channel);
|
||||
Assertions.assertNotNull(ret);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOrAddChannelTest01() {
|
||||
void getOrAddChannelTest01() {
|
||||
channel = new MockChannel() {
|
||||
@Override
|
||||
public URL getUrl() {
|
||||
|
|
@ -82,7 +82,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getOrAddChannelTest02() {
|
||||
void getOrAddChannelTest02() {
|
||||
channel = null;
|
||||
HeaderExchangeChannel ret = HeaderExchangeChannel.getOrAddChannel(channel);
|
||||
Assertions.assertNull(ret);
|
||||
|
|
@ -90,7 +90,7 @@ public class HeaderExchangeChannelTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void removeChannelIfDisconnectedTest() {
|
||||
void removeChannelIfDisconnectedTest() {
|
||||
Assertions.assertNull(channel.getAttribute(CHANNEL_KEY));
|
||||
channel.setAttribute(CHANNEL_KEY, header);
|
||||
channel.close();
|
||||
|
|
@ -99,7 +99,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void sendTest00() {
|
||||
void sendTest00() {
|
||||
boolean sent = true;
|
||||
String message = "this is a test message";
|
||||
try {
|
||||
|
|
@ -111,7 +111,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void sendTest01() throws RemotingException {
|
||||
void sendTest01() throws RemotingException {
|
||||
boolean sent = true;
|
||||
String message = "this is a test message";
|
||||
header.send(message, sent);
|
||||
|
|
@ -120,7 +120,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void sendTest02() throws RemotingException {
|
||||
void sendTest02() throws RemotingException {
|
||||
boolean sent = true;
|
||||
int message = 1;
|
||||
header.send(message, sent);
|
||||
|
|
@ -131,7 +131,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void sendTest04() throws RemotingException {
|
||||
void sendTest04() throws RemotingException {
|
||||
String message = "this is a test message";
|
||||
header.send(message);
|
||||
List<Object> objects = channel.getSentObjects();
|
||||
|
|
@ -139,7 +139,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void requestTest01() throws RemotingException {
|
||||
void requestTest01() throws RemotingException {
|
||||
Assertions.assertThrows(RemotingException.class, () -> {
|
||||
header.close(1000);
|
||||
Object requestObject = new Object();
|
||||
|
|
@ -148,7 +148,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void requestTest02() throws RemotingException {
|
||||
void requestTest02() throws RemotingException {
|
||||
Channel channel = Mockito.mock(MockChannel.class);
|
||||
header = new HeaderExchangeChannel(channel);
|
||||
when(channel.getUrl()).thenReturn(url);
|
||||
|
|
@ -160,7 +160,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void requestTest03() throws RemotingException {
|
||||
void requestTest03() throws RemotingException {
|
||||
Assertions.assertThrows(RemotingException.class, () -> {
|
||||
channel = new MockChannel() {
|
||||
@Override
|
||||
|
|
@ -175,12 +175,12 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void isClosedTest() {
|
||||
void isClosedTest() {
|
||||
Assertions.assertFalse(header.isClosed());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void closeTest() {
|
||||
void closeTest() {
|
||||
Assertions.assertFalse(channel.isClosed());
|
||||
header.close();
|
||||
Assertions.assertTrue(channel.isClosed());
|
||||
|
|
@ -188,7 +188,7 @@ public class HeaderExchangeChannelTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void closeWithTimeoutTest02() {
|
||||
void closeWithTimeoutTest02() {
|
||||
Assertions.assertFalse(channel.isClosed());
|
||||
Request request = new Request();
|
||||
DefaultFuture.newFuture(channel, request, 100, null);
|
||||
|
|
@ -199,7 +199,7 @@ public class HeaderExchangeChannelTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void startCloseTest() {
|
||||
void startCloseTest() {
|
||||
try {
|
||||
boolean isClosing = channel.isClosing();
|
||||
Assertions.assertFalse(isClosing);
|
||||
|
|
@ -212,46 +212,46 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getLocalAddressTest() {
|
||||
void getLocalAddressTest() {
|
||||
Assertions.assertNull(header.getLocalAddress());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getRemoteAddressTest() {
|
||||
void getRemoteAddressTest() {
|
||||
Assertions.assertNull(header.getRemoteAddress());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUrlTest() {
|
||||
void getUrlTest() {
|
||||
Assertions.assertEquals(header.getUrl(), URL.valueOf("dubbo://localhost:20880"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isConnectedTest() {
|
||||
void isConnectedTest() {
|
||||
Assertions.assertFalse(header.isConnected());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getChannelHandlerTest() {
|
||||
void getChannelHandlerTest() {
|
||||
Assertions.assertNull(header.getChannelHandler());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getExchangeHandlerTest() {
|
||||
void getExchangeHandlerTest() {
|
||||
Assertions.assertNull(header.getExchangeHandler());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getAttributeAndSetAttributeTest() {
|
||||
void getAttributeAndSetAttributeTest() {
|
||||
header.setAttribute("test", "test");
|
||||
Assertions.assertEquals(header.getAttribute("test"), "test");
|
||||
Assertions.assertTrue(header.hasAttribute("test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeAttributeTest() {
|
||||
void removeAttributeTest() {
|
||||
header.setAttribute("test", "test");
|
||||
Assertions.assertEquals(header.getAttribute("test"), "test");
|
||||
header.removeAttribute("test");
|
||||
|
|
@ -260,14 +260,14 @@ public class HeaderExchangeChannelTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void hasAttributeTest() {
|
||||
void hasAttributeTest() {
|
||||
Assertions.assertFalse(header.hasAttribute("test"));
|
||||
header.setAttribute("test", "test");
|
||||
Assertions.assertTrue(header.hasAttribute("test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeTest() {
|
||||
void hashCodeTest() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((channel == null) ? 0 : channel.hashCode());
|
||||
|
|
@ -276,7 +276,7 @@ public class HeaderExchangeChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void equalsTest() {
|
||||
void equalsTest() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
Assertions.assertEquals(header, new HeaderExchangeChannel(channel));
|
||||
header = new HeaderExchangeChannel(null);
|
||||
|
|
@ -286,7 +286,7 @@ public class HeaderExchangeChannelTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void toStringTest() {
|
||||
void toStringTest() {
|
||||
Assertions.assertEquals(header.toString(), channel.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ import java.util.Collection;
|
|||
/**
|
||||
* {@link HeaderExchangeServer}
|
||||
*/
|
||||
public class HeaderExchangeServerTest {
|
||||
class HeaderExchangeServerTest {
|
||||
|
||||
@Test
|
||||
public void test() throws InterruptedException, RemotingException {
|
||||
void test() throws InterruptedException, RemotingException {
|
||||
RemotingServer server = Mockito.mock(RemotingServer.class);
|
||||
URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 20881);
|
||||
Mockito.when(server.getUrl()).thenReturn(url);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_VERSION_KEY;
|
||||
import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK;
|
||||
|
||||
public class HeartBeatTaskTest {
|
||||
class HeartBeatTaskTest {
|
||||
|
||||
private URL url = URL.valueOf("dubbo://localhost:20880");
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ public class HeartBeatTaskTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHeartBeat() throws Exception {
|
||||
void testHeartBeat() throws Exception {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
url = url.addParameter(DUBBO_VERSION_KEY, "2.1.1");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_VERSION_KEY;
|
||||
import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK;
|
||||
|
||||
public class ReconnectTimerTaskTest {
|
||||
class ReconnectTimerTaskTest {
|
||||
|
||||
private URL url = URL.valueOf("dubbo://localhost:20880");
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public class ReconnectTimerTaskTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReconnect() throws Exception {
|
||||
void testReconnect() throws Exception {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
url = url.addParameter(DUBBO_VERSION_KEY, "2.1.1");
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
||||
public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest {
|
||||
class ConnectChannelHandlerTest extends WrappedChannelHandlerTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
|
|
@ -41,7 +41,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConnectBlocked() throws RemotingException {
|
||||
void testConnectBlocked() throws RemotingException {
|
||||
handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url);
|
||||
ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "connectionExecutor", 1);
|
||||
Assertions.assertEquals(1, executor.getMaximumPoolSize());
|
||||
|
|
@ -77,7 +77,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConnectExecuteError() throws RemotingException {
|
||||
void testConnectExecuteError() throws RemotingException {
|
||||
Assertions.assertThrows(ExecutionException.class, () -> {
|
||||
handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url);
|
||||
ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "connectionExecutor", 1);
|
||||
|
|
@ -87,7 +87,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDisconnectExecuteError() throws RemotingException {
|
||||
void testDisconnectExecuteError() throws RemotingException {
|
||||
Assertions.assertThrows(ExecutionException.class, () -> {
|
||||
handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url);
|
||||
ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "connectionExecutor", 1);
|
||||
|
|
@ -104,7 +104,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest {
|
|||
|
||||
//throw ChannelEventRunnable.runtimeExeception(int logger) not in execute exception
|
||||
@Test
|
||||
public void testCaughtBizError() throws RemotingException {
|
||||
void testCaughtBizError() throws RemotingException {
|
||||
handler.caught(new MockedChannel(), new BizException());
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest {
|
|||
@SuppressWarnings("deprecation")
|
||||
@Disabled("Heartbeat is processed in HeartbeatHandler not WrappedChannelHandler.")
|
||||
@Test
|
||||
public void testReceivedEventInvokeDirect() throws RemotingException {
|
||||
void testReceivedEventInvokeDirect() throws RemotingException {
|
||||
handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url);
|
||||
ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "SHARED_EXECUTOR", 1);
|
||||
executor.shutdown();
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.READONLY_EVENT;
|
||||
|
||||
//TODO response test
|
||||
public class HeaderExchangeHandlerTest {
|
||||
class HeaderExchangeHandlerTest {
|
||||
|
||||
@Test
|
||||
public void testReceivedRequestOneway() throws RemotingException {
|
||||
void testReceivedRequestOneway() throws RemotingException {
|
||||
final Channel mockChannel = new MockedChannel();
|
||||
|
||||
final Person requestData = new Person("charles");
|
||||
|
|
@ -59,7 +59,7 @@ public class HeaderExchangeHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedRequestTwoway() throws RemotingException {
|
||||
void testReceivedRequestTwoway() throws RemotingException {
|
||||
final Person requestData = new Person("charles");
|
||||
final Request request = new Request();
|
||||
request.setTwoWay(true);
|
||||
|
|
@ -95,12 +95,12 @@ public class HeaderExchangeHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedRequestTwowayErrorWithNullHandler() throws RemotingException {
|
||||
void testReceivedRequestTwowayErrorWithNullHandler() throws RemotingException {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> new HeaderExchangeHandler(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedRequestTwowayErrorReply() throws RemotingException {
|
||||
void testReceivedRequestTwowayErrorReply() throws RemotingException {
|
||||
final Person requestData = new Person("charles");
|
||||
final Request request = new Request();
|
||||
request.setTwoWay(true);
|
||||
|
|
@ -131,7 +131,7 @@ public class HeaderExchangeHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedRequestTwowayErrorRequestBroken() throws RemotingException {
|
||||
void testReceivedRequestTwowayErrorRequestBroken() throws RemotingException {
|
||||
final Request request = new Request();
|
||||
request.setTwoWay(true);
|
||||
request.setData(new BizException());
|
||||
|
|
@ -156,7 +156,7 @@ public class HeaderExchangeHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedRequestEventReadonly() throws RemotingException {
|
||||
void testReceivedRequestEventReadonly() throws RemotingException {
|
||||
final Request request = new Request();
|
||||
request.setTwoWay(true);
|
||||
request.setEvent(READONLY_EVENT);
|
||||
|
|
@ -168,7 +168,7 @@ public class HeaderExchangeHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedRequestEventOtherDiscard() throws RemotingException {
|
||||
void testReceivedRequestEventOtherDiscard() throws RemotingException {
|
||||
final Request request = new Request();
|
||||
request.setTwoWay(true);
|
||||
request.setEvent("my event");
|
||||
|
|
@ -197,7 +197,7 @@ public class HeaderExchangeHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedResponseHeartbeatEvent() throws Exception {
|
||||
void testReceivedResponseHeartbeatEvent() throws Exception {
|
||||
Channel mockChannel = new MockedChannel();
|
||||
HeaderExchangeHandler headerExchangeHandler = new HeaderExchangeHandler(new MockedExchangeHandler());
|
||||
Response response = new Response(1);
|
||||
|
|
@ -208,7 +208,7 @@ public class HeaderExchangeHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReceivedResponse() throws Exception {
|
||||
void testReceivedResponse() throws Exception {
|
||||
Request request = new Request(1);
|
||||
request.setTwoWay(true);
|
||||
Channel mockChannel = new MockedChannel();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import java.util.concurrent.ExecutorService;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class WrappedChannelHandlerTest {
|
||||
class WrappedChannelHandlerTest {
|
||||
WrappedChannelHandler handler;
|
||||
URL url = URL.valueOf("test://10.20.30.40:1234");
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public class WrappedChannelHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test_Execute_Error() throws RemotingException {
|
||||
void test_Execute_Error() throws RemotingException {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -88,22 +88,22 @@ public class WrappedChannelHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConnectBizError() throws RemotingException {
|
||||
void testConnectBizError() throws RemotingException {
|
||||
Assertions.assertThrows(RemotingException.class, () -> handler.connected(new MockedChannel()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisconnectBizError() throws RemotingException {
|
||||
void testDisconnectBizError() throws RemotingException {
|
||||
Assertions.assertThrows(RemotingException.class, () -> handler.disconnected(new MockedChannel()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageReceivedBizError() throws RemotingException {
|
||||
void testMessageReceivedBizError() throws RemotingException {
|
||||
Assertions.assertThrows(RemotingException.class, () -> handler.received(new MockedChannel(), ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCaughtBizError() throws RemotingException {
|
||||
void testCaughtBizError() throws RemotingException {
|
||||
try {
|
||||
handler.caught(new MockedChannel(), new BizException());
|
||||
fail();
|
||||
|
|
@ -113,7 +113,7 @@ public class WrappedChannelHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetExecutor() {
|
||||
void testGetExecutor() {
|
||||
ExecutorService sharedExecutorService = handler.getSharedExecutorService();
|
||||
Assertions.assertNotNull(sharedExecutorService);
|
||||
ExecutorService preferredExecutorService = handler.getPreferredExecutorService(new Object());
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.Arrays;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class TelnetUtilsTest {
|
||||
class TelnetUtilsTest {
|
||||
|
||||
/**
|
||||
* abc - abc - abc
|
||||
|
|
@ -33,7 +33,7 @@ public class TelnetUtilsTest {
|
|||
* x - y - z
|
||||
*/
|
||||
@Test
|
||||
public void testToList() {
|
||||
void testToList() {
|
||||
List<List<String>> table = new LinkedList<>();
|
||||
table.add(Arrays.asList("abc","abc","abc"));
|
||||
table.add(Arrays.asList("1","2","3"));
|
||||
|
|
@ -56,7 +56,7 @@ public class TelnetUtilsTest {
|
|||
* +-----+-----+-----+
|
||||
*/
|
||||
@Test
|
||||
public void testToTable() {
|
||||
void testToTable() {
|
||||
List<List<String>> table = new LinkedList<>();
|
||||
table.add(Arrays.asList("abc","abc","abc"));
|
||||
table.add(Arrays.asList("1","2","3"));
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class ClearTelnetHandlerTest {
|
||||
class ClearTelnetHandlerTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i = 0; i < 50; i++) {
|
||||
buf.append("\r\n");
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ import org.mockito.Mockito;
|
|||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class ExitTelnetHandlerTest {
|
||||
class ExitTelnetHandlerTest {
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Channel channel = Mockito.mock(Channel.class);
|
||||
|
||||
ExitTelnetHandler exitTelnetHandler = new ExitTelnetHandler();
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class HelpTelnetHandlerTest {
|
||||
class HelpTelnetHandlerTest {
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Channel channel = Mockito.mock(Channel.class);
|
||||
Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345"));
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class StatusTelnetHandlerTest {
|
||||
class StatusTelnetHandlerTest {
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Channel channel = Mockito.mock(Channel.class);
|
||||
Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345"));
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import java.util.Map;
|
|||
class TelnetHandlerAdapterTest {
|
||||
|
||||
@Test
|
||||
public void testTelnet() throws RemotingException {
|
||||
void testTelnet() throws RemotingException {
|
||||
|
||||
Channel channel = Mockito.mock(Channel.class);
|
||||
Map<String, String> param = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ import static org.mockito.BDDMockito.given;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class AbstractCodecTest {
|
||||
class AbstractCodecTest {
|
||||
|
||||
@Test
|
||||
public void testCheckPayloadDefault8M() throws Exception {
|
||||
void testCheckPayloadDefault8M() throws Exception {
|
||||
Channel channel = mock(Channel.class);
|
||||
given(channel.getUrl()).willReturn(URL.valueOf("dubbo://1.1.1.1"));
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ public class AbstractCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void tesCheckPayloadMinusPayloadNoLimit() throws Exception {
|
||||
void tesCheckPayloadMinusPayloadNoLimit() throws Exception {
|
||||
Channel channel = mock(Channel.class);
|
||||
given(channel.getUrl()).willReturn(URL.valueOf("dubbo://1.1.1.1?payload=-1"));
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public class AbstractCodecTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsClientSide() {
|
||||
void testIsClientSide() {
|
||||
AbstractCodec codec = getAbstractCodec();
|
||||
|
||||
Channel channel = mock(Channel.class);
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ import org.mockito.Mockito;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
public class ChannelHandlerDispatcherTest {
|
||||
class ChannelHandlerDispatcherTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
ChannelHandlerDispatcher channelHandlerDispatcher = new ChannelHandlerDispatcher();
|
||||
MockChannelHandler channelHandler1 = new MockChannelHandler();
|
||||
MockChannelHandler channelHandler2 = new MockChannelHandler();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.apache.dubbo.remoting.transport;
|
|||
import org.apache.dubbo.common.serialize.ObjectOutput;
|
||||
import org.apache.dubbo.common.serialize.Serialization;
|
||||
import org.apache.dubbo.common.serialize.support.DefaultSerializationSelector;
|
||||
import org.apache.dubbo.remoting.Constants;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -29,10 +28,10 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.InputStream;
|
||||
|
||||
|
||||
public class CodecSupportTest {
|
||||
class CodecSupportTest {
|
||||
|
||||
@Test
|
||||
public void testHeartbeat() throws Exception {
|
||||
void testHeartbeat() throws Exception {
|
||||
Byte proto = CodecSupport.getIDByName(DefaultSerializationSelector.getDefaultRemotingSerialization());
|
||||
Serialization serialization = CodecSupport.getSerializationById(proto);
|
||||
byte[] nullBytes = CodecSupport.getNullBytesOf(serialization);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ import org.mockito.Mockito;
|
|||
/**
|
||||
* {@link DecodeHandler}
|
||||
*/
|
||||
public class DecodeHandlerTest {
|
||||
class DecodeHandlerTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
void test() throws Exception {
|
||||
ChannelHandler handler = Mockito.mock(ChannelHandler.class);
|
||||
Channel channel = Mockito.mock(Channel.class);
|
||||
DecodeHandler decodeHandler = new DecodeHandler(handler);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ import org.mockito.Mockito;
|
|||
/**
|
||||
* {@link MultiMessageHandler}
|
||||
*/
|
||||
public class MultiMessageHandlerTest {
|
||||
class MultiMessageHandlerTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
void test() throws Exception {
|
||||
ChannelHandler handler = Mockito.mock(ChannelHandler.class);
|
||||
Channel channel = Mockito.mock(Channel.class);
|
||||
MultiMessageHandler multiMessageHandler = new MultiMessageHandler(handler);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import org.apache.dubbo.remoting.codec.ExchangeCodecTest;
|
|||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
public class CodecAdapterTest extends ExchangeCodecTest {
|
||||
class CodecAdapterTest extends ExchangeCodecTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ import java.util.Arrays;
|
|||
/**
|
||||
* {@link ChannelEventRunnable}
|
||||
*/
|
||||
public class ChannelEventRunnableTest {
|
||||
class ChannelEventRunnableTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
void test() throws Exception {
|
||||
ChannelEventRunnable.ChannelState[] values = ChannelEventRunnable.ChannelState.values();
|
||||
Assertions.assertEquals(Arrays.toString(values), "[CONNECTED, DISCONNECTED, SENT, RECEIVED, CAUGHT]");
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class ChannelHandlersTest {
|
||||
class ChannelHandlersTest {
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
ChannelHandlers instance1 = ChannelHandlers.getInstance();
|
||||
ChannelHandlers instance2 = ChannelHandlers.getInstance();
|
||||
Assertions.assertEquals(instance1, instance2);
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ import org.apache.dubbo.remoting.exchange.Response;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PayloadDropperTest {
|
||||
class PayloadDropperTest {
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Request request = new Request(1);
|
||||
request.setData(new Object());
|
||||
Request requestWithoutData = (Request) PayloadDropper.getRequestWithoutData(request);
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import org.apache.dubbo.common.URL;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class UrlUtilsTest {
|
||||
class UrlUtilsTest {
|
||||
@Test
|
||||
public void testGetIdleTimeout() {
|
||||
void testGetIdleTimeout() {
|
||||
URL url1 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000");
|
||||
URL url2 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000&heartbeat.timeout=50000");
|
||||
URL url3 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000&heartbeat.timeout=10000");
|
||||
|
|
@ -33,7 +33,7 @@ public class UrlUtilsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetHeartbeat() {
|
||||
void testGetHeartbeat() {
|
||||
URL url = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000");
|
||||
Assertions.assertEquals(UrlUtils.getHeartbeat(url), 10000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import java.io.IOException;
|
|||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
|
||||
public class JettyHttpBinderTest {
|
||||
class JettyHttpBinderTest {
|
||||
@Test
|
||||
public void shouldAbleHandleRequestForJettyBinder() throws Exception {
|
||||
void shouldAbleHandleRequestForJettyBinder() throws Exception {
|
||||
int port = NetUtils.getAvailablePort();
|
||||
URL url = new ServiceConfigURL("http", "localhost", port,
|
||||
new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class JettyLoggerAdapterTest {
|
||||
class JettyLoggerAdapterTest {
|
||||
|
||||
@Test
|
||||
public void testJettyUseDubboLogger() throws Exception{
|
||||
void testJettyUseDubboLogger() throws Exception{
|
||||
int port = NetUtils.getAvailablePort();
|
||||
URL url = new ServiceConfigURL("http", "localhost", port,
|
||||
new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});
|
||||
|
|
@ -64,7 +64,7 @@ public class JettyLoggerAdapterTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testSuccessLogger() throws Exception{
|
||||
void testSuccessLogger() throws Exception{
|
||||
Logger successLogger = mock(Logger.class);
|
||||
Class<?> clazz = Class.forName("org.apache.dubbo.remoting.http.jetty.JettyLoggerAdapter");
|
||||
JettyLoggerAdapter jettyLoggerAdapter = (JettyLoggerAdapter) clazz.newInstance();
|
||||
|
|
@ -98,7 +98,7 @@ public class JettyLoggerAdapterTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testNewLogger(){
|
||||
void testNewLogger(){
|
||||
JettyLoggerAdapter loggerAdapter = new JettyLoggerAdapter();
|
||||
org.eclipse.jetty.util.log.Logger logger = loggerAdapter.newLogger(this.getClass().getName());
|
||||
assertThat(logger.getClass().isAssignableFrom(JettyLoggerAdapter.class), is(true));
|
||||
|
|
@ -106,7 +106,7 @@ public class JettyLoggerAdapterTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testDebugEnabled(){
|
||||
void testDebugEnabled(){
|
||||
JettyLoggerAdapter loggerAdapter = new JettyLoggerAdapter();
|
||||
loggerAdapter.setDebugEnabled(true);
|
||||
assertThat(loggerAdapter.isDebugEnabled(), is(true));
|
||||
|
|
@ -114,7 +114,7 @@ public class JettyLoggerAdapterTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testLoggerFormat() throws Exception{
|
||||
void testLoggerFormat() throws Exception{
|
||||
Class<?> clazz = Class.forName("org.apache.dubbo.remoting.http.jetty.JettyLoggerAdapter");
|
||||
Object newInstance = clazz.newInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import java.io.IOException;
|
|||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
|
||||
public class TomcatHttpBinderTest {
|
||||
class TomcatHttpBinderTest {
|
||||
@Test
|
||||
public void shouldAbleHandleRequestForTomcatBinder() throws Exception {
|
||||
void shouldAbleHandleRequestForTomcatBinder() throws Exception {
|
||||
int port = NetUtils.getAvailablePort();
|
||||
URL url = new ServiceConfigURL("http", "localhost", port,
|
||||
new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import org.junit.jupiter.api.Test;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class HeartbeatHandlerTest {
|
||||
class HeartbeatHandlerTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(HeartbeatHandlerTest.class);
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ public class HeartbeatHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testServerHeartbeat() throws Exception {
|
||||
void testServerHeartbeat() throws Exception {
|
||||
FakeChannelHandlers.resetChannelHandlers();
|
||||
URL serverURL = URL.valueOf("telnet://localhost:" + NetUtils.getAvailablePort(56780))
|
||||
.addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME)
|
||||
|
|
@ -91,7 +91,7 @@ public class HeartbeatHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHeartbeat() throws Exception {
|
||||
void testHeartbeat() throws Exception {
|
||||
URL serverURL = URL.valueOf("telnet://localhost:" + NetUtils.getAvailablePort(56785))
|
||||
.addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME)
|
||||
.addParameter(Constants.TRANSPORTER_KEY, "netty3")
|
||||
|
|
@ -112,7 +112,7 @@ public class HeartbeatHandlerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClientHeartbeat() throws Exception {
|
||||
void testClientHeartbeat() throws Exception {
|
||||
FakeChannelHandlers.setTestingChannelHandlers();
|
||||
URL serverURL = URL.valueOf("telnet://localhost:" + NetUtils.getAvailablePort(56790))
|
||||
.addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
|
|||
/**
|
||||
* Client reconnect test
|
||||
*/
|
||||
public class ClientReconnectTest {
|
||||
class ClientReconnectTest {
|
||||
|
||||
@BeforeEach
|
||||
public void clear() {
|
||||
|
|
@ -41,7 +41,7 @@ public class ClientReconnectTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReconnect() throws RemotingException, InterruptedException {
|
||||
void testReconnect() throws RemotingException, InterruptedException {
|
||||
{
|
||||
int port = NetUtils.getAvailablePort();
|
||||
Client client = startClient(port, 200);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public abstract class ClientToServerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFuture() throws Exception {
|
||||
void testFuture() throws Exception {
|
||||
CompletableFuture<Object> future = client.request(new World("world"));
|
||||
Hello result = (Hello) future.get();
|
||||
Assertions.assertEquals("hello,world", result.getName());
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class ClientsTest {
|
||||
class ClientsTest {
|
||||
|
||||
@Test
|
||||
public void testGetTransportEmpty() {
|
||||
void testGetTransportEmpty() {
|
||||
try {
|
||||
ExtensionLoader.getExtensionLoader(Transporter.class).getExtension("");
|
||||
fail();
|
||||
|
|
@ -41,7 +41,7 @@ public class ClientsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetTransportNull() {
|
||||
void testGetTransportNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
String name = null;
|
||||
ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name);
|
||||
|
|
@ -49,13 +49,13 @@ public class ClientsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetTransport3() {
|
||||
void testGetTransport3() {
|
||||
String name = "netty3";
|
||||
assertEquals(NettyTransporter.class, ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTransportWrong() {
|
||||
void testGetTransportWrong() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
String name = "nety";
|
||||
assertNull(ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass());
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package org.apache.dubbo.remoting.transport.netty;
|
|||
|
||||
|
||||
import org.apache.dubbo.remoting.buffer.ChannelBuffer;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
|
@ -25,7 +26,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class NettyBackedChannelBufferTest {
|
||||
class NettyBackedChannelBufferTest {
|
||||
|
||||
private static final int CAPACITY = 4096;
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ public class NettyBackedChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBufferTransfer() {
|
||||
void testBufferTransfer() {
|
||||
byte[] tmp1 = {1, 2};
|
||||
byte[] tmp2 = {3, 4};
|
||||
ChannelBuffer source = new NettyBackedChannelBuffer(ChannelBuffers.dynamicBuffer(2));
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
|||
* Date: 5/3/11
|
||||
* Time: 5:47 PM
|
||||
*/
|
||||
public class NettyClientTest {
|
||||
class NettyClientTest {
|
||||
static RemotingServer server;
|
||||
static int port = NetUtils.getAvailablePort();
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ public class NettyClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testClientClose() throws Exception {
|
||||
void testClientClose() throws Exception {
|
||||
List<ExchangeChannel> clients = new ArrayList<ExchangeChannel>(100);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty3&codec=exchange"));
|
||||
|
|
@ -72,7 +72,7 @@ public class NettyClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testServerClose() throws Exception {
|
||||
void testServerClose() throws Exception {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
RemotingServer aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + NetUtils.getAvailablePort(6000) + "?server=netty3&codec=exchange"), new TelnetServerHandler());
|
||||
aServer.close();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.apache.dubbo.remoting.exchange.support.Replier;
|
|||
/**
|
||||
* NettyClientToServerTest
|
||||
*/
|
||||
public class NettyClientToServerTest extends ClientToServerTest {
|
||||
class NettyClientToServerTest extends ClientToServerTest {
|
||||
|
||||
protected ExchangeServer newServer(int port, Replier<?> receiver) throws RemotingException {
|
||||
// add heartbeat cycle to avoid unstable ut.
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
|
|||
* Date: 4/26/11
|
||||
* Time: 4:13 PM
|
||||
*/
|
||||
public class NettyStringTest {
|
||||
class NettyStringTest {
|
||||
static ExchangeServer server;
|
||||
static ExchangeChannel client;
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ public class NettyStringTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHandler() throws Exception {
|
||||
void testHandler() throws Exception {
|
||||
//Thread.sleep(20000);
|
||||
/*client.request("world\r\n");
|
||||
Future future = client.request("world", 10000);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import java.util.Random;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ThreadNameTest {
|
||||
class ThreadNameTest {
|
||||
|
||||
private NettyServer server;
|
||||
private NettyClient client;
|
||||
|
|
@ -79,7 +79,7 @@ public class ThreadNameTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testThreadName() throws Exception {
|
||||
void testThreadName() throws Exception {
|
||||
client.send("hello");
|
||||
serverLatch.await(30, TimeUnit.SECONDS);
|
||||
clientLatch.await(30, TimeUnit.SECONDS);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
|
|||
/**
|
||||
* Client reconnect test
|
||||
*/
|
||||
public class ClientReconnectTest {
|
||||
class ClientReconnectTest {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(3 % 1);
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ public class ClientReconnectTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testReconnect() throws RemotingException, InterruptedException {
|
||||
void testReconnect() throws RemotingException, InterruptedException {
|
||||
{
|
||||
int port = NetUtils.getAvailablePort();
|
||||
Client client = startClient(port, 200);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public abstract class ClientToServerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFuture() throws Exception {
|
||||
void testFuture() throws Exception {
|
||||
CompletableFuture<Object> future = client.request(new World("world"));
|
||||
Hello result = (Hello) future.get();
|
||||
Assertions.assertEquals("hello,world", result.getName());
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class ClientsTest {
|
||||
class ClientsTest {
|
||||
@Test
|
||||
public void testGetTransportEmpty() {
|
||||
void testGetTransportEmpty() {
|
||||
|
||||
try {
|
||||
ExtensionLoader.getExtensionLoader(Transporter.class).getExtension("");
|
||||
|
|
@ -41,7 +41,7 @@ public class ClientsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetTransportNull() {
|
||||
void testGetTransportNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
String name = null;
|
||||
ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name);
|
||||
|
|
@ -49,13 +49,13 @@ public class ClientsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetTransport3() {
|
||||
void testGetTransport3() {
|
||||
String name = "netty4";
|
||||
assertEquals(NettyTransporter.class, ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTransportWrong() {
|
||||
void testGetTransportWrong() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
String name = "nety";
|
||||
assertNull(ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass());
|
||||
|
|
|
|||
|
|
@ -17,16 +17,16 @@
|
|||
package org.apache.dubbo.remoting.transport.netty4;
|
||||
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import org.apache.dubbo.remoting.buffer.ChannelBuffer;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class NettyBackedChannelBufferTest {
|
||||
class NettyBackedChannelBufferTest {
|
||||
|
||||
private static final int CAPACITY = 4096;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ public class NettyBackedChannelBufferTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBufferTransfer() {
|
||||
void testBufferTransfer() {
|
||||
byte[] tmp1 = {1, 2};
|
||||
byte[] tmp2 = {3, 4};
|
||||
ChannelBuffer source = new NettyBackedChannelBuffer(Unpooled.buffer(2, 4));
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ import org.mockito.Mockito;
|
|||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public class NettyChannelTest {
|
||||
class NettyChannelTest {
|
||||
private Channel channel = Mockito.mock(Channel.class);
|
||||
private URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 8080);
|
||||
private ChannelHandler channelHandler = Mockito.mock(ChannelHandler.class);
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
void test() throws Exception {
|
||||
Channel channel = Mockito.mock(Channel.class);
|
||||
Mockito.when(channel.isActive()).thenReturn(true);
|
||||
URL url = URL.valueOf("test://127.0.0.1/test");
|
||||
|
|
@ -63,7 +63,7 @@ public class NettyChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAddress() {
|
||||
void testAddress() {
|
||||
NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler);
|
||||
InetSocketAddress localAddress = InetSocketAddress.createUnresolved("127.0.0.1", 8888);
|
||||
InetSocketAddress remoteAddress = InetSocketAddress.createUnresolved("127.0.0.1", 9999);
|
||||
|
|
@ -74,7 +74,7 @@ public class NettyChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSend() throws Exception {
|
||||
void testSend() throws Exception {
|
||||
NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler);
|
||||
ChannelFuture future = Mockito.mock(ChannelFuture.class);
|
||||
Mockito.when(future.await(1000)).thenReturn(true);
|
||||
|
|
@ -98,7 +98,7 @@ public class NettyChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAttribute() {
|
||||
void testAttribute() {
|
||||
NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler);
|
||||
nettyChannel.setAttribute("k1", "v1");
|
||||
Assertions.assertTrue(nettyChannel.hasAttribute("k1"));
|
||||
|
|
@ -108,7 +108,7 @@ public class NettyChannelTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
void testEquals() {
|
||||
Channel channel2 = Mockito.mock(Channel.class);
|
||||
NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler);
|
||||
NettyChannel nettyChannel2 = NettyChannel.getOrAddChannel(channel2, url, channelHandler);
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ import static org.mockito.ArgumentMatchers.any;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class NettyClientHandlerTest {
|
||||
class NettyClientHandlerTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
void test() throws Exception {
|
||||
URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 20901);
|
||||
ChannelHandler handler = Mockito.mock(ChannelHandler.class);
|
||||
ChannelHandlerContext ctx = Mockito.mock(ChannelHandlerContext.class);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.apache.dubbo.remoting.exchange.support.Replier;
|
|||
/**
|
||||
* Netty4ClientToServerTest
|
||||
*/
|
||||
public class NettyClientToServerTest extends ClientToServerTest {
|
||||
class NettyClientToServerTest extends ClientToServerTest {
|
||||
|
||||
protected ExchangeServer newServer(int port, Replier<?> receiver) throws RemotingException {
|
||||
// add heartbeat cycle to avoid unstable ut.
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ import org.mockito.Mockito;
|
|||
/**
|
||||
* {@link NettyCodecAdapter}
|
||||
*/
|
||||
public class NettyCodecAdapterTest {
|
||||
class NettyCodecAdapterTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Codec2 codec2 = Mockito.mock(Codec2.class);
|
||||
URL url = Mockito.mock(URL.class);
|
||||
ChannelHandler handler = Mockito.mock(ChannelHandler.class);
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import java.util.concurrent.CountDownLatch;
|
|||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class NettyTransporterTest {
|
||||
class NettyTransporterTest {
|
||||
@Test
|
||||
public void shouldAbleToBindNetty4() throws Exception {
|
||||
void shouldAbleToBindNetty4() throws Exception {
|
||||
int port = NetUtils.getAvailablePort();
|
||||
URL url = new ServiceConfigURL("telnet", "localhost", port,
|
||||
new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)});
|
||||
|
|
@ -45,7 +45,7 @@ public class NettyTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void shouldConnectToNetty4Server() throws Exception {
|
||||
void shouldConnectToNetty4Server() throws Exception {
|
||||
final CountDownLatch lock = new CountDownLatch(1);
|
||||
|
||||
int port = NetUtils.getAvailablePort();
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ import org.apache.dubbo.remoting.exchange.PortUnificationExchanger;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PortUnificationExchangerTest {
|
||||
class PortUnificationExchangerTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
int port = NetUtils.getAvailablePort();
|
||||
URL url = URL.valueOf("empty://127.0.0.1:" + port + "?foo=bar");
|
||||
PortUnificationExchanger.bind(url, new DefaultPuHandler());
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ import org.apache.dubbo.remoting.api.pu.DefaultPuHandler;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PortUnificationServerTest {
|
||||
class PortUnificationServerTest {
|
||||
|
||||
@Test
|
||||
public void testBind() throws RemotingException {
|
||||
void testBind() throws RemotingException {
|
||||
int port = NetUtils.getAvailablePort();
|
||||
URL url = URL.valueOf("empty://127.0.0.1:" + port + "?foo=bar");
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
* ReplierDispatcherTest
|
||||
*/
|
||||
|
||||
public class ReplierDispatcherTest {
|
||||
class ReplierDispatcherTest {
|
||||
|
||||
private ExchangeServer exchangeServer;
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ public class ReplierDispatcherTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testDataPackage() throws Exception {
|
||||
void testDataPackage() throws Exception {
|
||||
ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?" + CommonConstants.TIMEOUT_KEY + "=60000"));
|
||||
Random random = new Random();
|
||||
for (int i = 5; i < 100; i++) {
|
||||
|
|
@ -80,7 +80,7 @@ public class ReplierDispatcherTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testMultiThread() throws Exception {
|
||||
void testMultiThread() throws Exception {
|
||||
int tc = 10;
|
||||
ExecutorService exec = Executors.newFixedThreadPool(tc);
|
||||
for (int i = 0; i < tc; i++)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class Curator5ZookeeperClientTest {
|
||||
class Curator5ZookeeperClientTest {
|
||||
private static Curator5ZookeeperClient curatorClient;
|
||||
private static CuratorFramework client = null;
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ public class Curator5ZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCheckExists() {
|
||||
void testCheckExists() {
|
||||
String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers";
|
||||
curatorClient.create(path, false);
|
||||
assertThat(curatorClient.checkExists(path), is(true));
|
||||
|
|
@ -64,7 +64,7 @@ public class Curator5ZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testChildrenPath() {
|
||||
void testChildrenPath() {
|
||||
String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers";
|
||||
curatorClient.create(path, false);
|
||||
curatorClient.create(path + "/provider1", false);
|
||||
|
|
@ -93,7 +93,7 @@ public class Curator5ZookeeperClientTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testWithInvalidServer() {
|
||||
void testWithInvalidServer() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
curatorClient = new Curator5ZookeeperClient(URL.valueOf("zookeeper://127.0.0.1:1/service?timeout=1000"));
|
||||
curatorClient.create("/testPath", true);
|
||||
|
|
@ -101,27 +101,27 @@ public class Curator5ZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveChildrenListener() {
|
||||
void testRemoveChildrenListener() {
|
||||
ChildListener childListener = mock(ChildListener.class);
|
||||
curatorClient.addChildListener("/children", childListener);
|
||||
curatorClient.removeChildListener("/children", childListener);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateExistingPath() {
|
||||
void testCreateExistingPath() {
|
||||
curatorClient.create("/pathOne", false);
|
||||
curatorClient.create("/pathOne", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnectedStatus() {
|
||||
void testConnectedStatus() {
|
||||
curatorClient.createEphemeral("/testPath");
|
||||
boolean connected = curatorClient.isConnected();
|
||||
assertThat(connected, is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateContent4Persistent() {
|
||||
void testCreateContent4Persistent() {
|
||||
String path = "/curatorTest4CrContent/content.data";
|
||||
String content = "createContentTest";
|
||||
curatorClient.delete(path);
|
||||
|
|
@ -134,7 +134,7 @@ public class Curator5ZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateContent4Temp() {
|
||||
void testCreateContent4Temp() {
|
||||
String path = "/curatorTest4CrContent/content.data";
|
||||
String content = "createContentTest";
|
||||
curatorClient.delete(path);
|
||||
|
|
@ -147,7 +147,7 @@ public class Curator5ZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAddTargetDataListener() throws Exception {
|
||||
void testAddTargetDataListener() throws Exception {
|
||||
String listenerPath = "/dubbo/service.name/configuration";
|
||||
String path = listenerPath + "/dat/data";
|
||||
String value = "vav";
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
import static org.hamcrest.core.IsNot.not;
|
||||
import static org.hamcrest.core.IsNull.nullValue;
|
||||
|
||||
public class Curator5ZookeeperTransporterTest {
|
||||
class Curator5ZookeeperTransporterTest {
|
||||
private ZookeeperClient zookeeperClient;
|
||||
private Curator5ZookeeperTransporter curatorZookeeperTransporter;
|
||||
private static String zookeeperConnectionAddress1;
|
||||
|
|
@ -44,7 +44,7 @@ public class Curator5ZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testZookeeperClient() {
|
||||
void testZookeeperClient() {
|
||||
assertThat(zookeeperClient, not(nullValue()));
|
||||
zookeeperClient.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.hamcrest.core.IsNull.nullValue;
|
|||
/**
|
||||
* AbstractZookeeperTransporterTest
|
||||
*/
|
||||
public class AbstractZookeeperTransporterTest {
|
||||
class AbstractZookeeperTransporterTest {
|
||||
private ZookeeperClient zookeeperClient;
|
||||
private AbstractZookeeperTransporter abstractZookeeperTransporter;
|
||||
|
||||
|
|
@ -57,13 +57,13 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testZookeeperClient() {
|
||||
void testZookeeperClient() {
|
||||
assertThat(zookeeperClient, not(nullValue()));
|
||||
zookeeperClient.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetURLBackupAddress() {
|
||||
void testGetURLBackupAddress() {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + 9099 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
List<String> stringList = abstractZookeeperTransporter.getURLBackupAddress(url);
|
||||
Assertions.assertEquals(stringList.size(), 2);
|
||||
|
|
@ -72,7 +72,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetURLBackupAddressNoBack() {
|
||||
void testGetURLBackupAddressNoBack() {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
List<String> stringList = abstractZookeeperTransporter.getURLBackupAddress(url);
|
||||
Assertions.assertEquals(stringList.size(), 1);
|
||||
|
|
@ -80,7 +80,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFetchAndUpdateZookeeperClientCache() throws Exception {
|
||||
void testFetchAndUpdateZookeeperClientCache() throws Exception {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + ",127.0.0.1:" + zookeeperServerPort2 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url);
|
||||
//just for connected
|
||||
|
|
@ -101,7 +101,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatConnect() {
|
||||
void testRepeatConnect() {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url);
|
||||
|
|
@ -120,7 +120,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNotRepeatConnect() throws Exception {
|
||||
void testNotRepeatConnect() throws Exception {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url);
|
||||
|
|
@ -139,7 +139,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatConnectForBackUpAdd() throws Exception {
|
||||
void testRepeatConnectForBackUpAdd() throws Exception {
|
||||
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?backup=127.0.0.1:" + zookeeperServerPort2 + "&address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
|
|
@ -159,7 +159,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatConnectForNoMatchBackUpAdd() throws Exception {
|
||||
void testRepeatConnectForNoMatchBackUpAdd() throws Exception {
|
||||
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
|
|
@ -179,7 +179,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSameHostWithDifferentUser() throws Exception {
|
||||
void testSameHostWithDifferentUser() throws Exception {
|
||||
URL url1 = URL.valueOf("zookeeper://us1:pw1@127.0.0.1:" + zookeeperServerPort1 + "/path1");
|
||||
URL url2 = URL.valueOf("zookeeper://us2:pw2@127.0.0.1:" + zookeeperServerPort1 + "/path2");
|
||||
ZookeeperClient client1 = abstractZookeeperTransporter.connect(url1);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
public class CuratorZookeeperClientTest {
|
||||
class CuratorZookeeperClientTest {
|
||||
private CuratorZookeeperClient curatorClient;
|
||||
CuratorFramework client = null;
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ public class CuratorZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCheckExists() {
|
||||
void testCheckExists() {
|
||||
String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers";
|
||||
curatorClient.create(path, false);
|
||||
assertThat(curatorClient.checkExists(path), is(true));
|
||||
|
|
@ -73,7 +73,7 @@ public class CuratorZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testChildrenPath() {
|
||||
void testChildrenPath() {
|
||||
String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers";
|
||||
curatorClient.create(path, false);
|
||||
curatorClient.create(path + "/provider1", false);
|
||||
|
|
@ -102,7 +102,7 @@ public class CuratorZookeeperClientTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testWithInvalidServer() {
|
||||
void testWithInvalidServer() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
curatorClient = new CuratorZookeeperClient(URL.valueOf("zookeeper://127.0.0.1:1/service"));
|
||||
curatorClient.create("/testPath", true);
|
||||
|
|
@ -119,27 +119,27 @@ public class CuratorZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveChildrenListener() {
|
||||
void testRemoveChildrenListener() {
|
||||
ChildListener childListener = mock(ChildListener.class);
|
||||
curatorClient.addChildListener("/children", childListener);
|
||||
curatorClient.removeChildListener("/children", childListener);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateExistingPath() {
|
||||
void testCreateExistingPath() {
|
||||
curatorClient.create("/pathOne", false);
|
||||
curatorClient.create("/pathOne", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnectedStatus() {
|
||||
void testConnectedStatus() {
|
||||
curatorClient.createEphemeral("/testPath");
|
||||
boolean connected = curatorClient.isConnected();
|
||||
assertThat(connected, is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateContent4Persistent() {
|
||||
void testCreateContent4Persistent() {
|
||||
String path = "/curatorTest4CrContent/content.data";
|
||||
String content = "createContentTest";
|
||||
curatorClient.delete(path);
|
||||
|
|
@ -152,7 +152,7 @@ public class CuratorZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateContent4Temp() {
|
||||
void testCreateContent4Temp() {
|
||||
String path = "/curatorTest4CrContent/content.data";
|
||||
String content = "createContentTest";
|
||||
curatorClient.delete(path);
|
||||
|
|
@ -170,7 +170,7 @@ public class CuratorZookeeperClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAddTargetDataListener() throws Exception {
|
||||
void testAddTargetDataListener() throws Exception {
|
||||
String listenerPath = "/dubbo/service.name/configuration";
|
||||
String path = listenerPath + "/dat/data";
|
||||
String value = "vav";
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import static org.hamcrest.core.IsNot.not;
|
|||
import static org.hamcrest.core.IsNull.nullValue;
|
||||
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
public class CuratorZookeeperTransporterTest {
|
||||
class CuratorZookeeperTransporterTest {
|
||||
private ZookeeperClient zookeeperClient;
|
||||
private CuratorZookeeperTransporter curatorZookeeperTransporter;
|
||||
private static String zookeeperConnectionAddress1;
|
||||
|
|
@ -47,7 +47,7 @@ public class CuratorZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testZookeeperClient() {
|
||||
void testZookeeperClient() {
|
||||
assertThat(zookeeperClient, not(nullValue()));
|
||||
zookeeperClient.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import static org.hamcrest.core.IsNull.nullValue;
|
|||
* AbstractZookeeperTransporterTest
|
||||
*/
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
public class AbstractZookeeperTransporterTest {
|
||||
class AbstractZookeeperTransporterTest {
|
||||
private ZookeeperClient zookeeperClient;
|
||||
private AbstractZookeeperTransporter abstractZookeeperTransporter;
|
||||
|
||||
|
|
@ -61,13 +61,13 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testZookeeperClient() {
|
||||
void testZookeeperClient() {
|
||||
assertThat(zookeeperClient, not(nullValue()));
|
||||
zookeeperClient.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetURLBackupAddress() {
|
||||
void testGetURLBackupAddress() {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + 9099 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
List<String> stringList = abstractZookeeperTransporter.getURLBackupAddress(url);
|
||||
Assertions.assertEquals(stringList.size(), 2);
|
||||
|
|
@ -76,7 +76,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetURLBackupAddressNoBack() {
|
||||
void testGetURLBackupAddressNoBack() {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
List<String> stringList = abstractZookeeperTransporter.getURLBackupAddress(url);
|
||||
Assertions.assertEquals(stringList.size(), 1);
|
||||
|
|
@ -84,7 +84,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFetchAndUpdateZookeeperClientCache() throws Exception {
|
||||
void testFetchAndUpdateZookeeperClientCache() throws Exception {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + ",127.0.0.1:" + zookeeperServerPort2 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url);
|
||||
//just for connected
|
||||
|
|
@ -105,7 +105,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatConnect() {
|
||||
void testRepeatConnect() {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url);
|
||||
|
|
@ -124,7 +124,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNotRepeatConnect() throws Exception {
|
||||
void testNotRepeatConnect() throws Exception {
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url);
|
||||
|
|
@ -143,7 +143,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatConnectForBackUpAdd() throws Exception {
|
||||
void testRepeatConnectForBackUpAdd() throws Exception {
|
||||
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?backup=127.0.0.1:" + zookeeperServerPort2 + "&address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
|
|
@ -163,7 +163,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatConnectForNoMatchBackUpAdd() throws Exception {
|
||||
void testRepeatConnectForNoMatchBackUpAdd() throws Exception {
|
||||
|
||||
URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828");
|
||||
URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true");
|
||||
|
|
@ -183,7 +183,7 @@ public class AbstractZookeeperTransporterTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSameHostWithDifferentUser() throws Exception {
|
||||
void testSameHostWithDifferentUser() throws Exception {
|
||||
URL url1 = URL.valueOf("zookeeper://us1:pw1@127.0.0.1:" + zookeeperServerPort1 + "/path1");
|
||||
URL url2 = URL.valueOf("zookeeper://us2:pw2@127.0.0.1:" + zookeeperServerPort1 + "/path2");
|
||||
ZookeeperClient client1 = abstractZookeeperTransporter.connect(url1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue