This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new b2365dec5 [Task]add sdk-http-integratedtest(#3925) (#4189)
b2365dec5 is described below
commit b2365dec58fbbd0092f86af03a08035f10219d77
Author: 杨文杰 <[email protected]>
AuthorDate: Tue Nov 22 15:31:15 2022 +0800
[Task]add sdk-http-integratedtest(#3925) (#4189)
* add sdk-http-integratedtest
* trigger ci
* trigger ci
Co-authored-by: xiaoyu <[email protected]>
Co-authored-by: yunlongn <[email protected]>
---
.github/workflows/integrated-test.yml | 1 +
.../shenyu-examples-sdk-http/pom.xml | 5 +
.../controller/ShenyuHttpSdkExampleController.java | 6 +-
shenyu-integrated-test/pom.xml | 1 +
.../integratedtest/common/helper/HttpHelper.java | 30 ++++
.../shenyu-integrated-test-sdk-http/Dockerfile | 29 ++++
.../docker-compose.yml | 100 ++++++++++++++
.../shenyu-integrated-test-sdk-http}/pom.xml | 83 +++++------
.../script/healthcheck.sh | 36 +++++
.../script/services.list | 19 +++
.../test/sdk/http/SdkHttpIntegratedBootstrap.java | 38 ++++++
.../integrated/test/sdk/http/dto/SdkTestDto.java | 65 +++++++++
.../src/main/resources/application.yml | 152 +++++++++++++++++++++
.../test/sdk/http/SdkHttpIntegratedTest.java | 46 +++++++
14 files changed, 560 insertions(+), 51 deletions(-)
diff --git a/.github/workflows/integrated-test.yml
b/.github/workflows/integrated-test.yml
index 56f2e2dba..0d5b05c58 100644
--- a/.github/workflows/integrated-test.yml
+++ b/.github/workflows/integrated-test.yml
@@ -37,6 +37,7 @@ jobs:
- shenyu-integrated-test-websocket
- shenyu-integrated-test-combination
- shenyu-integrated-test-sdk-apache-dubbo
+ - shenyu-integrated-test-sdk-http
runs-on: ubuntu-latest
if: (github.repository == 'apache/shenyu')
steps:
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
index bbe1f74d1..7f509cf60 100644
--- a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
+++ b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
@@ -63,6 +63,11 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+
</dependencies>
<build>
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/ShenyuHttpSdkExampleController.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/ShenyuHttpSdkExampleController.java
index 1ac98a0f0..b665fe81a 100644
---
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/ShenyuHttpSdkExampleController.java
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/ShenyuHttpSdkExampleController.java
@@ -42,7 +42,7 @@ public class ShenyuHttpSdkExampleController {
* @param id id
* @return SdkTestDto
*/
- @GetMapping("sdk/findById")
+ @GetMapping("sdk/http/findById")
public SdkTestDto findById(final @RequestParam("id") String id) {
return shenyuHttpClientApi.findById(id);
}
@@ -54,9 +54,9 @@ public class ShenyuHttpSdkExampleController {
* @param sdkTestDto sdkTestDto
* @return sdkTestDto
*/
- @PostMapping("sdk/annoTest")
+ @PostMapping("sdk/http/annoTest")
public SdkTestDto annoTest(final @RequestBody SdkTestDto sdkTestDto) {
- return shenyuHttpClientApi.annoTest("cookie", "header", "9",
sdkTestDto);
+ return shenyuHttpClientApi.annoTest("cookie", "header",
sdkTestDto.getId(), sdkTestDto);
}
}
diff --git a/shenyu-integrated-test/pom.xml b/shenyu-integrated-test/pom.xml
index e813a7a39..fa6160979 100644
--- a/shenyu-integrated-test/pom.xml
+++ b/shenyu-integrated-test/pom.xml
@@ -42,6 +42,7 @@
<module>shenyu-integrated-test-combination</module>
<module>shenyu-integrated-test-sdk-apache-dubbo</module>
<module>shenyu-integrated-test-sdk-alibaba-dubbo</module>
+ <module>shenyu-integrated-test-sdk-http</module>
</modules>
<properties>
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
b/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
index 68d77d8c2..40d7ab195 100644
---
a/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
+++
b/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/helper/HttpHelper.java
@@ -285,4 +285,34 @@ public class HttpHelper {
return (S) respBody;
}
}
+
+ /**
+ * postHttpService.
+ *
+ * @param <S> response type
+ * @param <Q> request type
+ * @param url full url
+ * @param headers headers
+ * @param req request
+ * @param respType respTypeClass
+ * @return responseObject
+
+ * @throws IOException IO exception
+ */
+ public <S, Q> S postHttpService(final String url, final Map<String,
Object> headers, final Q req, final Class<S> respType) throws IOException {
+ Request.Builder requestBuilder = new
Request.Builder().post(RequestBody.create(GSON.toJson(req),
JSON)).url(url).addHeader(Constants.LOCAL_KEY, localKey);
+ if (!CollectionUtils.isEmpty(headers)) {
+ headers.forEach((key, value) -> requestBuilder.addHeader(key,
String.valueOf(value)));
+ }
+ Request request = requestBuilder.build();
+ Response response = client.newCall(request).execute();
+ String respBody = Objects.requireNonNull(response.body()).string();
+ LOG.info("postHttpService({}) resp({})", url, respBody);
+ try {
+ return GSON.fromJson(respBody, respType);
+ } catch (Exception e) {
+ return (S) respBody;
+ }
+ }
+
}
diff --git a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/Dockerfile
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/Dockerfile
new file mode 100644
index 000000000..3a7d6aa32
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/Dockerfile
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM openjdk:8-jre-alpine
+
+ENV APP_NAME shenyu-integrated-test-sdk-http
+ENV LOCAL_PATH /opt/${APP_NAME}
+
+RUN mkdir -p ${LOCAL_PATH}
+
+ADD target/${APP_NAME}.jar ${LOCAL_PATH}
+
+WORKDIR ${LOCAL_PATH}
+EXPOSE 9195
+
+CMD java -jar ${APP_NAME}.jar
\ No newline at end of file
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/docker-compose.yml
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/docker-compose.yml
new file mode 100644
index 000000000..c22f27db1
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/docker-compose.yml
@@ -0,0 +1,100 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+version: "3.9"
+services:
+ shenyu-zk:
+ container_name: shenyu-zk
+ image: zookeeper:3.5
+ restart: always
+ ports:
+ - "2181:2181"
+ networks:
+ - shenyu
+
+ shenyu-admin:
+ image: apache/shenyu-admin:latest
+ container_name: shenyu-admin
+ restart: always
+ networks:
+ - shenyu
+ depends_on:
+ shenyu-zk:
+ condition: service_started
+ ports:
+ - "9095:9095"
+ environment:
+ - SPRING_PROFILES_ACTIVE=h2
+ - shenyu.database.init_script=sql-script/h2/schema.sql
+ healthcheck:
+ test: ["CMD-SHELL", "wget -q -O -
http://shenyu-admin:9095/actuator/health | grep UP || exit 1"]
+ timeout: 2s
+ retries: 30
+ start_period: 5s
+
+ shenyu-examples-sdk-http:
+ deploy:
+ resources:
+ limits:
+ memory: 2048M
+ container_name: shenyu-examples-sdk-http
+ image: shenyu-examples-sdk-http:latest
+ restart: always
+ environment:
+ - shenyu.register.serverLists=http://shenyu-admin:9095
+ - shenyu.sdk.register-type=zookeeper
+ - shenyu.sdk.server-lists=shenyu-zk:2181
+ healthcheck:
+ test: [ "CMD", "wget",
"http://shenyu-examples-sdk-http:8899/actuator/health | grep UP || exit 1"]
+ timeout: 2s
+ retries: 3
+ start_period: 5s
+ ports:
+ - "8899:8899"
+ networks:
+ - shenyu
+ depends_on:
+ shenyu-integrated-test-sdk-http:
+ condition: service_healthy
+
+ shenyu-integrated-test-sdk-http:
+ container_name: shenyu-integrated-test-sdk-http
+ image: apache/shenyu-integrated-test-sdk-http:latest
+ restart: always
+ deploy:
+ resources:
+ limits:
+ memory: 2048M
+ environment:
+ - shenyu.sync.websocket.urls=ws://shenyu-admin:9095/websocket
+ - shenyu.register.registerType=zookeeper
+ - shenyu.register.serverLists=shenyu-zk:2181
+ depends_on:
+ shenyu-admin:
+ condition: service_healthy
+ ports:
+ - "9195:9195"
+ - "8090:8090"
+ healthcheck:
+ test: [ "CMD", "wget", "-q", "-O", "-",
"http://shenyu-integrated-test-sdk-http:9195/actuator/health" ]
+ timeout: 2s
+ retries: 3
+ start_period: 5s
+ networks:
+ - shenyu
+
+networks:
+ shenyu:
+ name: shenyu
\ No newline at end of file
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/pom.xml
similarity index 59%
copy from shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
copy to shenyu-integrated-test/shenyu-integrated-test-sdk-http/pom.xml
index bbe1f74d1..2cede7663 100644
--- a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
+++ b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/pom.xml
@@ -19,78 +19,57 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>shenyu-examples-sdk</artifactId>
+ <artifactId>shenyu-integrated-test</artifactId>
<groupId>org.apache.shenyu</groupId>
<version>2.5.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>shenyu-examples-sdk-http</artifactId>
+ <artifactId>shenyu-integrated-test-sdk-http</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-sdk-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-sdk-httpclient</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </dependency>
- <!--spring bootstrap-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
+ <artifactId>shenyu-integrated-test-common</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-spring-boot-starter-sdk</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.shenyu</groupId>
-
<artifactId>shenyu-spring-boot-starter-client-springmvc</artifactId>
+ <artifactId>shenyu-spring-boot-starter-instance</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
- <build>
- <finalName>shenyu-examples-sdk-http</finalName>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
-
<mainClass>org.apache.shenyu.examples.sdk.http.ShenyuSdkHttpExampleApplication</mainClass>
- <executable>true</executable>
- </configuration>
- </plugin>
- </plugins>
- </build>
<profiles>
<profile>
- <id>example</id>
+ <id>it</id>
<properties>
-
<docker.buildArg.APP_NAME>shenyu-examples-sdk-http</docker.buildArg.APP_NAME>
-
<docker.image.tag.repo>shenyu-examples-sdk-http</docker.image.tag.repo>
+
<docker.buildArg.APP_NAME>shenyu-integrated-test-sdk-http</docker.buildArg.APP_NAME>
+
<docker.image.tag.repo>apache/shenyu-integrated-test-sdk-http</docker.image.tag.repo>
<docker.image.tag.tagName>latest</docker.image.tag.tagName>
</properties>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
<build>
+ <finalName>shenyu-integrated-test-sdk-http</finalName>
<plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot.version}</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+
<mainClass>org.apache.shenyu.integrated.test.sdk.http.SdkHttpIntegratedBootstrap</mainClass>
+ <executable>true</executable>
+ </configuration>
+ </plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
@@ -98,7 +77,7 @@
<configuration>
<images>
<image>
- <name>shenyu-examples-sdk-http</name>
+
<name>apache/shenyu-integrated-test-sdk-http</name>
<build>
<contextDir>${project.basedir}</contextDir>
</build>
@@ -114,8 +93,16 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>false</skipTests>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
</profiles>
+
</project>
\ No newline at end of file
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/script/healthcheck.sh
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/script/healthcheck.sh
new file mode 100644
index 000000000..22a76034a
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/script/healthcheck.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+PRGDIR=`dirname "$0"`
+for service in `grep -v -E "^$|^#" ${PRGDIR}/services.list`
+do
+ for loop in `seq 1 30`
+ do
+ status=`curl -o /dev/null -s -w %{http_code} $service`
+ echo -e "curl $service response $status"
+
+ if [ $status -eq 200 ]; then
+ break
+ fi
+
+ sleep 2
+ done
+done
+
+sleep 3
+echo -e "\n-------------------"
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/script/services.list
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/script/services.list
new file mode 100644
index 000000000..fce7267e3
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/script/services.list
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+http://localhost:9095/actuator/health
+http://localhost:9195/actuator/health
+http://localhost:8899/actuator/health
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/java/org/apache/shenyu/integrated/test/sdk/http/SdkHttpIntegratedBootstrap.java
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/java/org/apache/shenyu/integrated/test/sdk/http/SdkHttpIntegratedBootstrap.java
new file mode 100644
index 000000000..ebced3bac
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/java/org/apache/shenyu/integrated/test/sdk/http/SdkHttpIntegratedBootstrap.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.sdk.http;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * SdkIntegratedBootstrap.
+ */
+@SpringBootApplication
+public class SdkHttpIntegratedBootstrap {
+
+ /**
+ * main.
+ *
+ * @param args args
+ */
+ public static void main(final String[] args) {
+ SpringApplication.run(SdkHttpIntegratedBootstrap.class, args);
+ }
+
+}
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/java/org/apache/shenyu/integrated/test/sdk/http/dto/SdkTestDto.java
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/java/org/apache/shenyu/integrated/test/sdk/http/dto/SdkTestDto.java
new file mode 100644
index 000000000..421f2628e
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/java/org/apache/shenyu/integrated/test/sdk/http/dto/SdkTestDto.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.sdk.http.dto;
+
+/**
+ * SdkTestDto.
+ */
+public class SdkTestDto {
+
+ private String id;
+
+ private String name;
+
+ /**
+ * getId.
+ *
+ * @return id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * setId.
+ *
+ * @param id id
+ */
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ /**
+ * getName.
+ *
+ * @return name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * setName.
+ *
+ * @param name name
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+}
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/resources/application.yml
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/resources/application.yml
new file mode 100644
index 000000000..ea8e73bba
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/resources/application.yml
@@ -0,0 +1,152 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+server:
+ port: 9195
+ address: 0.0.0.0
+
+spring:
+ main:
+ allow-bean-definition-overriding: true
+ application:
+ name: shenyu-bootstrap
+
+management:
+ health:
+ defaults:
+ enabled: false
+
+shenyu:
+ matchCache:
+ selectorEnabled: false
+ ruleEnabled: true
+ maxSelectorFreeMemory: 256 # 256MB
+ maxRuleFreeMemory: 256 # 256MB
+ netty:
+ http:
+ # set to false, user can custom the netty tcp server config.
+ webServerFactoryEnabled: true
+ selectCount: 1
+ workerCount: 4
+ accessLog: false
+ serverSocketChannel:
+ soRcvBuf: 87380
+ soBackLog: 128
+ soReuseAddr: false
+ connectTimeoutMillis: 10000
+ writeBufferHighWaterMark: 65536
+ writeBufferLowWaterMark: 32768
+ writeSpinCount: 16
+ autoRead: false
+ allocType: "pooled"
+ messageSizeEstimator: 8
+ singleEventExecutorPerGroup: true
+ socketChannel:
+ soKeepAlive: false
+ soReuseAddr: false
+ soLinger: -1
+ tcpNoDelay: true
+ soRcvBuf: 87380
+ soSndBuf: 16384
+ ipTos: 0
+ allowHalfClosure: false
+ connectTimeoutMillis: 10000
+ writeBufferHighWaterMark: 65536
+ writeBufferLowWaterMark: 32768
+ writeSpinCount: 16
+ autoRead: false
+ allocType: "pooled"
+ messageSizeEstimator: 8
+ singleEventExecutorPerGroup: true
+ register:
+ enabled: true
+ registerType: zookeeper #etcd #consul
+ serverLists: localhost:2181 #http://localhost:2379 #localhost:8848
+ props:
+ cross:
+ enabled: true
+ allowedHeaders:
+ allowedMethods: "*"
+ allowedAnyOrigin: true # the same of Access-Control-Allow-Origin: "*"
+ allowedExpose: ""
+ maxAge: "18000"
+ allowCredentials: true
+
+ switchConfig:
+ local: true
+ file:
+ enabled: true
+ maxSize : 10
+ sync:
+ websocket:
+ urls: ws://localhost:9095/websocket
+ allowOrigin: ws://localhost:9195
+ exclude:
+ enabled: true
+ paths:
+ - /favicon.ico
+ - /actuator/health
+ fallback:
+ enabled: false
+ paths:
+ - /fallback/hystrix
+ - /fallback/resilience4j
+ health:
+ enabled: false
+ paths:
+ - /actuator/health
+ - /health_check
+ extPlugin:
+ path:
+ enabled: true
+ threads: 1
+ scheduleTime: 300
+ scheduleDelay: 30
+ scheduler:
+ enabled: false
+ type: fixed
+ threads: 16
+ upstreamCheck:
+ enabled: false
+ timeout: 3000
+ healthyThreshold: 1
+ unhealthyThreshold: 1
+ interval: 5000
+ printEnabled: true
+ printInterval: 60000
+ ribbon:
+ serverListRefreshInterval: 10000
+ metrics:
+ enabled: false
+ name : prometheus
+ host: 127.0.0.1
+ port: 8090
+ jmxConfig:
+ props:
+ jvm_enabled: true
+ # plugins:
+ # rate-limiter.enabled: false
+ local:
+ enabled: false
+ sha512Key:
"BA3253876AED6BC22D4A6FF53D8406C6AD864195ED144AB5C87621B6C233B548BAEAE6956DF346EC8C17F5EA10F35EE3CBC514797ED7DDD3145464E2A0BAB413"
+
+logging:
+ level:
+ root: info
+ org.springframework.boot: info
+ org.apache.ibatis: info
+ org.apache.shenyu.bonuspoint: info
+ org.apache.shenyu.lottery: info
+ org.apache.shenyu: info
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/test/java/org/apache/shenyu/integrated/test/sdk/http/SdkHttpIntegratedTest.java
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/test/java/org/apache/shenyu/integrated/test/sdk/http/SdkHttpIntegratedTest.java
new file mode 100644
index 000000000..7902fd795
--- /dev/null
+++
b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/test/java/org/apache/shenyu/integrated/test/sdk/http/SdkHttpIntegratedTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.integrated.test.sdk.http;
+
+import org.apache.shenyu.integrated.test.sdk.http.dto.SdkTestDto;
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class SdkHttpIntegratedTest extends AbstractPluginDataInit {
+
+ @Test
+ public void testFindById() throws IOException {
+ SdkTestDto sdkTestDto =
HttpHelper.INSTANCE.getHttpService("http://localhost:8899/sdk/http/findById?id=10",
null, SdkTestDto.class);
+ assertEquals("sdk-currentToken", sdkTestDto.getName());
+ }
+
+ @Test
+ public void testSdkAnno() throws IOException {
+ SdkTestDto request = new SdkTestDto();
+ request.setId("1");
+ request.setName("shenyu-sdk");
+ SdkTestDto sdkTestDto =
HttpHelper.INSTANCE.postHttpService("http://localhost:8899/sdk/http/annoTest",
null, request, SdkTestDto.class);
+ assertEquals("name=shenyu-sdk,Cookie=cookie,header=header",
sdkTestDto.getName());
+ }
+
+}