[feat] shenyu java client
diff --git a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/dto/URIRegisterDTO.java b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/dto/URIRegisterDTO.java index 5ed3de1..5c6f05c 100644 --- a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/dto/URIRegisterDTO.java +++ b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/dto/URIRegisterDTO.java
@@ -55,6 +55,7 @@ * @param host the host * @param port the port * @param eventType the event type + * @param namespaceId the namespace id */ public URIRegisterDTO(final String protocol, final String appName, final String contextPath, final String rpcType, final String host, final Integer port,
diff --git a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/utils/PortUtils.java b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/utils/PortUtils.java index f82c882..f151162 100644 --- a/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/utils/PortUtils.java +++ b/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/utils/PortUtils.java
@@ -43,7 +43,7 @@ * * @param beanFactory beanFactory * @return port number - * @throws ShenyuException when can not find port + * @throws RuntimeException when failed to get port */ @SuppressWarnings("all") public static int findPort(final BeanFactory beanFactory) {
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/pom.xml b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/pom.xml index b1abe3b..a421223 100644 --- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/pom.xml +++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/pom.xml
@@ -24,7 +24,7 @@ </parent> <modelVersion>4.0.0</modelVersion> <artifactId>shenyu-client-apache-dubbo</artifactId> - + <dependencies> <dependency> <groupId>org.apache.shenyu</groupId> @@ -35,6 +35,7 @@ <groupId>org.apache.dubbo</groupId> <artifactId>dubbo</artifactId> <version>${apache.dubbo.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -52,32 +53,21 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>jakarta.validation</groupId> - <artifactId>jakarta.validation-api</artifactId> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> - <version>8.0.1.Final</version> + <version>5.2.5.Final</version> <scope>test</scope> </dependency> <dependency> - <groupId>jakarta.el</groupId> - <artifactId>jakarta.el-api</artifactId> - <version>6.0.0</version> + <groupId>javax.el</groupId> + <artifactId>el-api</artifactId> + <version>2.2</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-el</artifactId> - <version>10.1.16</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-websocket</artifactId> - </dependency> - </dependencies> </project>
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/ApacheDubboClientValidatorTest.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/ApacheDubboClientValidatorTest.java index 60b5038..1162fad 100644 --- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/ApacheDubboClientValidatorTest.java +++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/ApacheDubboClientValidatorTest.java
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import jakarta.validation.ValidationException; +import javax.validation.ValidationException; import java.util.Collections; import java.util.HashMap; import java.util.List;
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraint.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraint.java index 710eb1d..334217f 100644 --- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraint.java +++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraint.java
@@ -17,8 +17,8 @@ package org.apache.shenyu.client.apache.dubbo.validation.mock; -import jakarta.validation.Constraint; -import jakarta.validation.Payload; +import javax.validation.Constraint; +import javax.validation.Payload; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy;
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraintValidator.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraintValidator.java index a3e9db6..0701943 100644 --- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraintValidator.java +++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockConstraintValidator.java
@@ -17,8 +17,8 @@ package org.apache.shenyu.client.apache.dubbo.validation.mock; -import jakarta.validation.ConstraintValidator; -import jakarta.validation.ConstraintValidatorContext; +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; /** * MockConstraintValidator.
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidationParameter.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidationParameter.java index 36bae79..c5036b9 100644 --- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidationParameter.java +++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidationParameter.java
@@ -17,7 +17,7 @@ package org.apache.shenyu.client.apache.dubbo.validation.mock; -import jakarta.validation.constraints.NotNull; +import javax.validation.constraints.NotNull; /** * MockValidationParameter.
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidatorTarget.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidatorTarget.java index 2cb1adb..07b4443 100644 --- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidatorTarget.java +++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/mock/MockValidatorTarget.java
@@ -19,7 +19,7 @@ import org.apache.dubbo.validation.MethodValidated; -import jakarta.validation.constraints.NotNull; +import javax.validation.constraints.NotNull; import java.util.List; import java.util.Map;
diff --git a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/service/TestService.java b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/service/TestService.java index a83f351..e3ac1fa 100644 --- a/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/service/TestService.java +++ b/shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/test/java/org/apache/shenyu/client/apache/dubbo/validation/service/TestService.java
@@ -17,7 +17,7 @@ package org.apache.shenyu.client.apache.dubbo.validation.service; -import jakarta.validation.constraints.NotNull; +import javax.validation.constraints.NotNull; import java.util.Objects; /**
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListenerTest.java b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListenerTest.java index 6b49356..fa6aa47 100644 --- a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListenerTest.java +++ b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/init/SpringMvcClientEventListenerTest.java
@@ -19,15 +19,14 @@ import org.apache.shenyu.client.core.constant.ShenyuClientConstants; import org.apache.shenyu.client.core.exception.ShenyuClientIllegalArgumentException; +import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepository; import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepositoryFactory; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig.ClientPropertiesConfig; +import org.apache.shenyu.client.core.register.config.ShenyuRegisterCenterConfig; +import org.apache.shenyu.client.core.utils.RegisterUtils; import org.apache.shenyu.client.springmvc.annotation.ShenyuSpringMvcClient; -import org.apache.shenyu.common.exception.ShenyuException; import org.apache.shenyu.client.core.utils.PortUtils; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.client.http.utils.RegisterUtils; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.register.common.config.ShenyuClientConfig.ClientPropertiesConfig; -import org.apache.shenyu.register.common.config.ShenyuRegisterCenterConfig; import org.junit.Assert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -174,7 +173,7 @@ public void testOnApplicationEventError() { init(); SpringMvcClientEventListener springMvcClientEventListener = buildSpringMvcClientEventListener(false, false); - Assert.assertThrows(ShenyuException.class, () -> springMvcClientEventListener.onApplicationEvent(contextRefreshedEvent)); + Assert.assertThrows(RuntimeException.class, () -> springMvcClientEventListener.onApplicationEvent(contextRefreshedEvent)); registerUtilsMockedStatic.close(); }
diff --git a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/register/SpringMvcApiMetaRegisterTest.java b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/register/SpringMvcApiMetaRegisterTest.java index ec8a7d5..6221c36 100644 --- a/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/register/SpringMvcApiMetaRegisterTest.java +++ b/shenyu-client/shenyu-client-http/shenyu-client-springmvc/src/test/java/org/apache/shenyu/client/springmvc/register/SpringMvcApiMetaRegisterTest.java
@@ -18,13 +18,13 @@ package org.apache.shenyu.client.springmvc.register; import org.apache.shenyu.client.core.disruptor.ShenyuClientRegisterEventPublisher; +import org.apache.shenyu.client.core.dto.MetaDataRegisterDTO; +import org.apache.shenyu.client.core.enums.RpcTypeEnum; import org.apache.shenyu.client.core.register.ApiBean; import org.apache.shenyu.client.core.register.ClientRegisterConfig; +import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepository; +import org.apache.shenyu.client.core.type.DataTypeParent; import org.apache.shenyu.client.springmvc.annotation.ShenyuSpringMvcClient; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.type.DataTypeParent; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java b/shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java index d7064f9..8afb6ec 100644 --- a/shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java +++ b/shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java
@@ -26,16 +26,17 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; + +import org.apache.shenyu.client.core.constant.Constants; +import org.apache.shenyu.client.core.dto.MetaDataRegisterDTO; +import org.apache.shenyu.client.core.dto.URIRegisterDTO; +import org.apache.shenyu.client.core.enums.EventType; +import org.apache.shenyu.client.core.enums.RpcTypeEnum; import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepositoryFactory; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig.ClientPropertiesConfig; +import org.apache.shenyu.client.core.register.config.ShenyuRegisterCenterConfig; import org.apache.shenyu.client.motan.common.annotation.ShenyuMotanClient; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.register.common.config.ShenyuClientConfig.ClientPropertiesConfig; -import org.apache.shenyu.register.common.config.ShenyuRegisterCenterConfig; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; -import org.apache.shenyu.register.common.enums.EventType; import org.jetbrains.annotations.NotNull; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull;
diff --git a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java b/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java index 26bacfa..a81395e 100644 --- a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java +++ b/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java
@@ -17,16 +17,16 @@ package org.apache.shenyu.client.tars; +import org.apache.shenyu.client.core.enums.RpcTypeEnum; import org.apache.shenyu.client.core.exception.ShenyuClientIllegalArgumentException; +import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepository; import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepositoryFactory; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig.ClientPropertiesConfig; +import org.apache.shenyu.client.core.register.config.ShenyuRegisterCenterConfig; +import org.apache.shenyu.client.core.utils.RegisterUtils; import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsClient; import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsService; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.client.http.utils.RegisterUtils; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.register.common.config.ShenyuClientConfig.ClientPropertiesConfig; -import org.apache.shenyu.register.common.config.ShenyuRegisterCenterConfig; import org.junit.Assert; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.MethodOrderer;
diff --git a/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/pom.xml b/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/pom.xml index 18b00bf..e5cfc24 100644 --- a/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/pom.xml +++ b/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/pom.xml
@@ -52,13 +52,13 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>jakarta.websocket</groupId> - <artifactId>jakarta.websocket-api</artifactId> + <groupId>javax.websocket</groupId> + <artifactId>javax.websocket-api</artifactId> <scope>provided</scope> </dependency> <dependency> - <groupId>jakarta.servlet</groupId> - <artifactId>jakarta.servlet-api</artifactId> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency>
diff --git a/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/ShenyuServerEndpointerExporterTest.java b/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/ShenyuServerEndpointerExporterTest.java index 0b5e3e9..33c5525 100644 --- a/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/ShenyuServerEndpointerExporterTest.java +++ b/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/ShenyuServerEndpointerExporterTest.java
@@ -18,7 +18,6 @@ package org.apache.shenyu.client.spring.websocket.init; import org.apache.shenyu.client.spring.websocket.annotation.ShenyuServerEndpoint; -import org.apache.shenyu.common.exception.ShenyuException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,9 +27,9 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.web.socket.server.standard.SpringConfigurator; -import jakarta.websocket.DeploymentException; -import jakarta.websocket.server.ServerContainer; -import jakarta.websocket.server.ServerEndpointConfig; +import javax.websocket.DeploymentException; +import javax.websocket.server.ServerContainer; +import javax.websocket.server.ServerEndpointConfig; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertSame; @@ -111,7 +110,7 @@ */ @Test public void registerEndpointMissingAnnotationTest() { - assertThrows(ShenyuException.class, () -> exporter.registerEndpoint(pojo.getClass())); + assertThrows(RuntimeException.class, () -> exporter.registerEndpoint(pojo.getClass())); verifyNoInteractions(serverContainer); }
diff --git a/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/SpringWebSocketClientEventListenerTest.java b/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/SpringWebSocketClientEventListenerTest.java index 52058ef..d49e450 100644 --- a/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/SpringWebSocketClientEventListenerTest.java +++ b/shenyu-client/shenyu-client-websocket/shenyu-client-spring-websocket/src/test/java/org/apache/shenyu/client/spring/websocket/init/SpringWebSocketClientEventListenerTest.java
@@ -17,17 +17,17 @@ package org.apache.shenyu.client.spring.websocket.init; +import org.apache.shenyu.client.core.constant.Constants; import org.apache.shenyu.client.core.constant.ShenyuClientConstants; import org.apache.shenyu.client.core.disruptor.ShenyuClientRegisterEventPublisher; +import org.apache.shenyu.client.core.dto.MetaDataRegisterDTO; +import org.apache.shenyu.client.core.dto.URIRegisterDTO; +import org.apache.shenyu.client.core.enums.RpcTypeEnum; +import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepository; +import org.apache.shenyu.client.core.register.config.PropertiesConfig; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig; +import org.apache.shenyu.client.core.register.config.ShenyuClientConfig.ClientPropertiesConfig; import org.apache.shenyu.client.spring.websocket.annotation.ShenyuSpringWebSocketClient; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.common.config.PropertiesConfig; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.register.common.config.ShenyuClientConfig.ClientPropertiesConfig; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith;