diff --git a/net/src/test/java/com/zfoo/net/core/gateway/GatewayTest.java b/net/src/test/java/com/zfoo/net/core/gateway/GatewayTest.java index be86664e..f869ec3e 100644 --- a/net/src/test/java/com/zfoo/net/core/gateway/GatewayTest.java +++ b/net/src/test/java/com/zfoo/net/core/gateway/GatewayTest.java @@ -18,7 +18,7 @@ import com.zfoo.net.core.HostAndPort; import com.zfoo.net.core.tcp.TcpClient; import com.zfoo.net.packet.gateway.GatewayToProviderRequest; import com.zfoo.net.packet.gateway.GatewayToProviderResponse; -import com.zfoo.net.session.SessionUtils; +import com.zfoo.net.util.SessionUtilsTest; import com.zfoo.protocol.util.JsonUtils; import com.zfoo.protocol.util.ThreadUtils; import org.junit.Ignore; @@ -51,21 +51,21 @@ public class GatewayTest { @Test public void startProvider0() { var context = new ClassPathXmlApplicationContext("provider/provider_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); ThreadUtils.sleep(Long.MAX_VALUE); } @Test public void startProvider1() { var context = new ClassPathXmlApplicationContext("provider/provider_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); ThreadUtils.sleep(Long.MAX_VALUE); } @Test public void startProvider2() { var context = new ClassPathXmlApplicationContext("provider/provider_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); ThreadUtils.sleep(Long.MAX_VALUE); } @@ -75,7 +75,7 @@ public class GatewayTest { @Test public void startGateway() { var context = new ClassPathXmlApplicationContext("gateway/gateway_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); // 注意:这里创建的是GatewayServer里面是GatewayRouteHandler(而不是BaseRouteHandler),里面会通过ConsumerSession把消息转发到Provider var gatewayServer = new GatewayServer(HostAndPort.valueOf("127.0.0.1:9000"), null); @@ -89,7 +89,7 @@ public class GatewayTest { @Test public void clientSyncTest() { var context = new ClassPathXmlApplicationContext("gateway/gateway_client_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); // 这里的地址是网关的地址 var client = new TcpClient(HostAndPort.valueOf("127.0.0.1:9000")); @@ -124,7 +124,7 @@ public class GatewayTest { @Test public void clientAsyncTest() { var context = new ClassPathXmlApplicationContext("gateway/gateway_client_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); // 这里的地址是网关的地址 var client = new TcpClient(HostAndPort.valueOf("127.0.0.1:9000")); diff --git a/net/src/test/java/com/zfoo/net/core/provider/ProviderTest.java b/net/src/test/java/com/zfoo/net/core/provider/ProviderTest.java index 126579a9..0c888ab8 100644 --- a/net/src/test/java/com/zfoo/net/core/provider/ProviderTest.java +++ b/net/src/test/java/com/zfoo/net/core/provider/ProviderTest.java @@ -16,7 +16,7 @@ package com.zfoo.net.core.provider; import com.zfoo.net.NetContext; import com.zfoo.net.packet.provider.ProviderMessAnswer; import com.zfoo.net.packet.provider.ProviderMessAsk; -import com.zfoo.net.session.SessionUtils; +import com.zfoo.net.util.SessionUtilsTest; import com.zfoo.protocol.util.JsonUtils; import com.zfoo.protocol.util.ThreadUtils; import org.junit.Ignore; @@ -45,21 +45,21 @@ public class ProviderTest { @Test public void startProvider0() { var context = new ClassPathXmlApplicationContext("provider/provider_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); ThreadUtils.sleep(Long.MAX_VALUE); } @Test public void startProvider1() { var context = new ClassPathXmlApplicationContext("provider/provider_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); ThreadUtils.sleep(Long.MAX_VALUE); } @Test public void startProvider2() { var context = new ClassPathXmlApplicationContext("provider/provider_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); ThreadUtils.sleep(Long.MAX_VALUE); } @@ -69,7 +69,7 @@ public class ProviderTest { @Test public void startSyncRandomConsumer() throws Exception { var context = new ClassPathXmlApplicationContext("provider/consumer_random_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); var ask = new ProviderMessAsk(); ask.setMessage("Hello, this is the consumer!"); @@ -88,7 +88,7 @@ public class ProviderTest { @Test public void startAsyncRandomConsumer() { var context = new ClassPathXmlApplicationContext("provider/consumer_random_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); var ask = new ProviderMessAsk(); ask.setMessage("Hello, this is the consumer!"); @@ -110,7 +110,7 @@ public class ProviderTest { @Test public void startConsistentHashConsumer() { var context = new ClassPathXmlApplicationContext("provider/consumer_consistent_hash_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); var ask = new ProviderMessAsk(); ask.setMessage("Hello, this is the consumer!"); @@ -132,7 +132,7 @@ public class ProviderTest { @Test public void startCachedConsistentHashConsumer() { var context = new ClassPathXmlApplicationContext("provider/consumer_cached_consistent_config.xml"); - SessionUtils.printSessionInfo(); + SessionUtilsTest.printSessionInfo(); var ask = new ProviderMessAsk(); ask.setMessage("Hello, this is the consumer!"); diff --git a/net/src/test/java/com/zfoo/net/session/SessionUtils.java b/net/src/test/java/com/zfoo/net/util/SessionUtilsTest.java similarity index 95% rename from net/src/test/java/com/zfoo/net/session/SessionUtils.java rename to net/src/test/java/com/zfoo/net/util/SessionUtilsTest.java index 8ee018be..f6c8799c 100644 --- a/net/src/test/java/com/zfoo/net/session/SessionUtils.java +++ b/net/src/test/java/com/zfoo/net/util/SessionUtilsTest.java @@ -11,9 +11,10 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.net.session; +package com.zfoo.net.util; import com.zfoo.net.NetContext; +import com.zfoo.net.session.Session; import com.zfoo.protocol.util.FileUtils; import com.zfoo.protocol.util.StringUtils; import com.zfoo.protocol.util.ThreadUtils; @@ -23,7 +24,7 @@ import java.util.function.Consumer; /** * @author godotg */ -public abstract class SessionUtils { +public class SessionUtilsTest { public static void printSessionInfo() { Thread thread = new Thread(() -> {