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/incubator-shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new d470bd1  Add integrated test for sofa plugin (#2158)
d470bd1 is described below

commit d470bd1e6ca16bbe6565bf4287ab8c6db86e43a4
Author: Kunshuai Zhu <[email protected]>
AuthorDate: Mon Sep 27 21:53:57 2021 -0500

    Add integrated test for sofa plugin (#2158)
---
 .github/workflows/integrated-test.yml              |   1 +
 .../shenyu-examples-sofa-service/Dockerfile        |  30 +++
 .../shenyu-examples-sofa-service/pom.xml           |  44 ++++
 shenyu-integrated-test/pom.xml                     |   1 +
 .../shenyu-integrated-test-sofa/Dockerfile         |  29 +++
 .../shenyu-integrated-test-sofa/docker-compose.yml | 110 ++++++++++
 .../shenyu-integrated-test-sofa/pom.xml            | 231 +++++++++++++++++++++
 .../script/healthcheck.sh                          |  36 ++++
 .../script/services.list                           |  19 ++
 .../test/sofa/SofaIntegratedBootstrap.java         |  34 +++
 .../integrated/test/sofa/dto/SofaTestData.java     |  51 +++++
 .../src/main/resources/admin-config/schema.sql     |  20 ++
 .../src/main/resources/application-local.yml       |  53 +++++
 .../src/main/resources/application.yml             |  18 ++
 .../integrated/test/sofa/SofaPluginTest.java       |  40 ++++
 15 files changed, 717 insertions(+)

diff --git a/.github/workflows/integrated-test.yml 
b/.github/workflows/integrated-test.yml
index 2d6bca7..01cbba5 100644
--- a/.github/workflows/integrated-test.yml
+++ b/.github/workflows/integrated-test.yml
@@ -32,6 +32,7 @@ jobs:
           - shenyu-integrated-test-http
           - shenyu-integrated-test-motan
           - shenyu-integrated-test-spring-cloud
+          - shenyu-integrated-test-sofa
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
diff --git 
a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/Dockerfile 
b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/Dockerfile
new file mode 100644
index 0000000..11c6091
--- /dev/null
+++ 
b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/Dockerfile
@@ -0,0 +1,30 @@
+# 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 java:openjdk-8-jre-alpine
+
+ENV APP_NAME shenyu-examples-sofa
+ENV LOCAL_PATH /opt/${APP_NAME}
+
+RUN mkdir -p ${LOCAL_PATH}
+
+ADD target/${APP_NAME}.jar ${LOCAL_PATH}
+
+WORKDIR ${LOCAL_PATH}
+EXPOSE 28011
+EXPOSE 8888
+
+CMD java -jar ${APP_NAME}.jar
diff --git 
a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/pom.xml 
b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/pom.xml
index c24f4f7..e754caf 100644
--- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/pom.xml
+++ b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/pom.xml
@@ -62,5 +62,49 @@
                 </exclusion>
             </exclusions>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
     </dependencies>
+
+    <build>
+        <finalName>shenyu-examples-sofa</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    
<mainClass>org.apache.shenyu.examples.sofa.service.TestSofaApplication</mainClass>
+                    <executable>true</executable>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>dockerfile-maven-plugin</artifactId>
+                <version>1.4.6</version>
+                <executions>
+                    <execution>
+                        <id>shenyu-examples-sofa</id>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <repository>shenyu-examples-sofa</repository>
+                    <tag>latest</tag>
+                    <buildArgs>
+                        <APP_NAME>shenyu-examples-sofa</APP_NAME>
+                    </buildArgs>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/shenyu-integrated-test/pom.xml b/shenyu-integrated-test/pom.xml
index a084df9..b799f1f 100644
--- a/shenyu-integrated-test/pom.xml
+++ b/shenyu-integrated-test/pom.xml
@@ -36,6 +36,7 @@
         <module>shenyu-integration-test-apache-dubbo</module>
         <module>shenyu-integrated-test-grpc</module>
         <module>shenyu-integrated-test-motan</module>
+        <module>shenyu-integrated-test-sofa</module>
     </modules>
 
     <properties>
diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/Dockerfile 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/Dockerfile
new file mode 100644
index 0000000..df0fe9f
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sofa/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 java:openjdk-8-jre-alpine
+
+ENV APP_NAME shenyu-integrated-test-sofa
+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
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml
new file mode 100644
index 0000000..aa7d388
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml
@@ -0,0 +1,110 @@
+# 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-redis:
+    image: redis:6.0-alpine
+    container_name: shenyu-redis
+    restart: always
+    command: redis-server --requirepass abc
+    networks:
+      - shenyu
+    healthcheck:
+      test: [ "CMD", "redis-cli", "ping" ]
+
+  shenyu-admin:
+    image: apache/shenyu-admin:2.4.1-SNAPSHOT
+    container_name: shenyu-admin
+    restart: always
+    networks:
+      - shenyu
+    volumes:
+      - type: bind
+        source: ./src/main/resources/admin-config/
+        target: /opt/sql/
+    depends_on:
+      - shenyu-redis
+      - shenyu-zk
+    ports:
+      - 9095:9095
+    environment:
+      - SPRING_PROFILES_ACTIVE=h2
+      - 
"shenyu.database.init_script=sql-script/h2/schema.sql;file:/opt/sql/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-sofa:
+    deploy:
+      resources:
+        limits:
+          memory: 2048M
+    container_name: shenyu-examples-sofa
+    image: shenyu-examples-sofa:latest
+    restart: always
+    environment:
+      - shenyu.client.serverLists=http://shenyu-admin:9095
+      - com.alipay.sofa.rpc.registry-address=zookeeper://shenyu-zk:2181
+    healthcheck:
+      test: [ "CMD-SHELL", "wget -q -O - http://localhost:28011/sofa/findAll | 
grep UP || exit 1" ]
+      timeout: 2s
+      retries: 3
+      start_period: 5s
+    ports:
+      - 28011:28011
+      - 8888:8888
+    networks:
+      - shenyu
+    depends_on:
+      shenyu-integrated-test-sofa:
+        condition: service_healthy
+
+  shenyu-integrated-test-sofa:
+    container_name: shenyu-integrated-test-sofa
+    image: apache/shenyu-integrated-test-sofa:latest
+    restart: always
+    deploy:
+      resources:
+        limits:
+          memory: 2048M
+    environment:
+      - shenyu.sync.websocket.urls=ws://shenyu-admin:9095/websocket
+    depends_on:
+      shenyu-admin:
+        condition: service_healthy
+    ports:
+      - 9195:9195
+    healthcheck:
+      test: [ "CMD", "wget", "-q", "-O", "-", 
"http://shenyu-integrated-test-sofa:9195/actuator/health"; ]
+      timeout: 2s
+      retries: 3
+      start_period: 5s
+    networks:
+      - shenyu
+
+networks:
+  shenyu:
+    name: shenyu
diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/pom.xml 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/pom.xml
new file mode 100644
index 0000000..c53872c
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sofa/pom.xml
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         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-integrated-test</artifactId>
+        <groupId>org.apache.shenyu</groupId>
+        <version>2.4.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>shenyu-integrated-test-sofa</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <!-- shenyu ratelimiter plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            
<artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu ratelimiter plugin end-->
+
+        <!-- shenyu hystrix plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-hystrix</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu hystrix plugin end-->
+
+        <!-- shenyu waf plugin starter-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-waf</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu waf plugin end-->
+
+        <!-- shenyu monitor plugin starter-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-monitor</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu monitor plugin end-->
+
+        <!-- shenyu sign plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-sign</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu sign plugin end-->
+
+        <!-- shenyu resilience4j plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            
<artifactId>shenyu-spring-boot-starter-plugin-resilience4j</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu resilience4j plugin end-->
+
+        <!-- shenyu sentinel plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-sentinel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu sentinel plugin end-->
+
+        <!-- shenyu redirect plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-redirect</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu redirect plugin end-->
+
+        <!-- shenyu redirect plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-rewrite</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu redirect plugin end-->
+
+        <!--shenyu debug plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-logging</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!--shenyu debug plugin end-->
+
+        <dependency>
+            <groupId>com.alipay.sofa</groupId>
+            <artifactId>sofa-rpc-all</artifactId>
+            <version>5.7.6</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>net.jcip</groupId>
+                    <artifactId>jcip-annotations</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-client</artifactId>
+            <version>4.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-framework</artifactId>
+            <version>4.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.curator</groupId>
+            <artifactId>curator-recipes</artifactId>
+            <version>4.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-sofa</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-jwt</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- shenyu modify response plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            
<artifactId>shenyu-spring-boot-starter-plugin-modify-response</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu modify response plugin end-->
+
+        <!-- shenyu response plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-spring-boot-starter-plugin-response</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- shenyu response plugin end-->
+
+        <!--shenyu param mapping plugin start-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            
<artifactId>shenyu-spring-boot-starter-plugin-param-mapping</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!--shenyu param mapping end-->
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-integrated-test-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>shenyu-integrated-test-sofa</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.sofa.SofaIntegratedBootstrap</mainClass>
+                    <executable>true</executable>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>dockerfile-maven-plugin</artifactId>
+                <version>${dockerfile-maven-plugin.version}</version>
+                <executions>
+                    <execution>
+                        <id>shenyu-integrated-test-sofa</id>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <repository>apache/shenyu-integrated-test-sofa</repository>
+                    <tag>latest</tag>
+                    <buildArgs>
+                        <APP_NAME>shenyu-integrated-test-sofa</APP_NAME>
+                    </buildArgs>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-sofa/script/healthcheck.sh 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/script/healthcheck.sh
new file mode 100644
index 0000000..22a7603
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sofa/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-sofa/script/services.list 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/script/services.list
new file mode 100644
index 0000000..032e35a
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sofa/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:28011/actuator/health
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/SofaIntegratedBootstrap.java
 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/SofaIntegratedBootstrap.java
new file mode 100644
index 0000000..766e3c9
--- /dev/null
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/SofaIntegratedBootstrap.java
@@ -0,0 +1,34 @@
+/*
+ * 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.sofa;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SofaIntegratedBootstrap {
+
+    /**
+     * main mathod of app.
+     *
+     * @param args args
+     */
+    public static void main(final String[] args) {
+        SpringApplication.run(SofaIntegratedBootstrap.class);
+    }
+}
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/dto/SofaTestData.java
 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/dto/SofaTestData.java
new file mode 100644
index 0000000..4d163cd
--- /dev/null
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/dto/SofaTestData.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sofa.dto;
+
+public class SofaTestData {
+
+    private String id;
+
+    private String name;
+
+    /**
+     * get id.
+     *
+     * @return id
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * get name.
+     *
+     * @return name
+     */
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String toString() {
+        return "SofaTest{"
+                + "id='" + id + '\''
+                + ", name='" + name + '\''
+                + '}';
+    }
+}
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/admin-config/schema.sql
 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/admin-config/schema.sql
new file mode 100644
index 0000000..58b8984
--- /dev/null
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/admin-config/schema.sql
@@ -0,0 +1,20 @@
+-- noinspection SqlNoDataSourceInspectionForFile
+
+-- 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.
+
+/** prepare sofa **/
+UPDATE `plugin` SET enabled = 1, config = 
'{"protocol":"zookeeper","register":"shenyu-zk:2181"}' WHERE id = '11';
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application-local.yml
 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application-local.yml
new file mode 100644
index 0000000..c35f578
--- /dev/null
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application-local.yml
@@ -0,0 +1,53 @@
+# 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:
+  switchConfig:
+    local: true
+  cross:
+    enabled: true
+  sync:
+    websocket:
+      urls: ws://shenyu-admin:9095/websocket
+  exclude:
+    enabled: true
+    paths:
+      - /favicon.ico
+      - /actuator/health
+
+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-sofa/src/main/resources/application.yml
 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application.yml
new file mode 100644
index 0000000..393ad24
--- /dev/null
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application.yml
@@ -0,0 +1,18 @@
+# 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.
+
+spring:
+  profiles:
+    active: local
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginTest.java
 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginTest.java
new file mode 100644
index 0000000..a3b6ea7
--- /dev/null
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sofa;
+
+import com.google.gson.reflect.TypeToken;
+import org.apache.shenyu.integrated.test.sofa.dto.SofaTestData;
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.dto.AdminResponse;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+public class SofaPluginTest extends AbstractPluginDataInit {
+
+    @Test
+    public void testHelloWorld() throws IOException {
+        AdminResponse<SofaTestData> response = 
HttpHelper.INSTANCE.getFromGateway("/sofa/findById?id=1001", new 
TypeToken<AdminResponse<SofaTestData>>() { }.getType());
+        assertThat(response.getData().getName(), is("hello world shenyu Sofa, 
findById"));
+        assertThat(response.getData().getId(), is("1001"));
+    }
+}

Reply via email to