This is an automated email from the ASF dual-hosted git repository.
haiqi 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 56d20f7d4 [type: feature] add e2e motan case (#4957)
56d20f7d4 is described below
commit 56d20f7d494e5b5ba6594aae217a602f59c1cf61
Author: SeaChess <[email protected]>
AuthorDate: Tue Aug 15 22:42:58 2023 +0800
[type: feature] add e2e motan case (#4957)
* add e2e motan case 01
* add e2e motan case 02
* add e2e motan case 03
* add e2e motan case 04
---------
Co-authored-by: zhengpeng <[email protected]>
---
.github/workflows/e2e.yaml | 2 +-
shenyu-e2e/shenyu-e2e-case/pom.xml | 1 +
.../shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml | 30 ++++
.../shenyu/e2e/testcase/motan/DataSynHttpTest.java | 74 ++++++++
.../e2e/testcase/motan/DataSynNacosTest.java | 75 ++++++++
.../e2e/testcase/motan/DataSynZookeeperTest.java | 75 ++++++++
.../e2e/testcase/motan/MotanPluginCases.java} | 180 ++++++++++---------
.../shenyu/e2e/testcase/motan/MotanPluginTest.java | 154 ++++++++++++++++
.../src/test/resources/admin-application.yml | 119 ++++++++++++
.../src/test/resources/bootstrap-application.yml | 200 +++++++++++++++++++++
.../src/test/resources/docker-compose.mysql.yml | 125 +++++++++++++
.../shenyu/e2e/testcase/sofa/SofaPluginCases.java | 10 +-
.../examples/motan/service/MotanDemoService.java | 6 +
.../motan/service/impl/MotanDemoServiceImpl.java | 8 +
14 files changed, 965 insertions(+), 94 deletions(-)
diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index 7780c06ff..6c58495c0 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -150,7 +150,7 @@ jobs:
if: ${{ needs.changes.outputs.e2e == 'true' }}
strategy:
matrix:
- case: [ "shenyu-e2e-case-spring-cloud",
"shenyu-e2e-case-apache-dubbo", "shenyu-e2e-case-sofa" ]
+ case: [ "shenyu-e2e-case-spring-cloud",
"shenyu-e2e-case-apache-dubbo", "shenyu-e2e-case-sofa", "shenyu-e2e-case-motan"
]
steps:
- uses: actions/checkout@v3
with:
diff --git a/shenyu-e2e/shenyu-e2e-case/pom.xml
b/shenyu-e2e/shenyu-e2e-case/pom.xml
index eb3bd1552..8bfeb47c1 100644
--- a/shenyu-e2e/shenyu-e2e-case/pom.xml
+++ b/shenyu-e2e/shenyu-e2e-case/pom.xml
@@ -34,6 +34,7 @@
<module>shenyu-e2e-case-alibaba-dubbo</module>
<module>shenyu-e2e-case-apache-dubbo</module>
<module>shenyu-e2e-case-sofa</module>
+ <module>shenyu-e2e-case-motan</module>
</modules>
<dependencies>
diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml
new file mode 100644
index 000000000..1b822f121
--- /dev/null
+++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml
@@ -0,0 +1,30 @@
+<?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-e2e-case</artifactId>
+ <groupId>org.apache.shenyu</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-e2e-case-motan</artifactId>
+
+</project>
\ No newline at end of file
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynHttpTest.java
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynHttpTest.java
new file mode 100644
index 000000000..a07863d32
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynHttpTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.e2e.testcase.motan;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Http data synchronization method.
+ */
+@ShenYuTest(
+ mode = ShenYuEngineConfigure.Mode.DOCKER,
+ services = {
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "admin",
+ port = 9095,
+ baseUrl = "http://{hostname:localhost}:9095",
+ parameters = {
+ @ShenYuTest.Parameter(key = "username", value
= "admin"),
+ @ShenYuTest.Parameter(key = "password", value
= "123456"),
+ @ShenYuTest.Parameter(key = "dataSyn", value =
"admin_http")
+ }
+ ),
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "gateway",
+ port = 9195,
+ baseUrl = "http://{hostname:localhost}:9195",
+ type =
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+ parameters = {
+ @ShenYuTest.Parameter(key = "dataSyn", value =
"gateway_http")
+ }
+ )
+ },
+ dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynHttpTest {
+
+ @Test
+ void testDataSyn(final AdminClient adminClient, final GatewayClient
gatewayClient) throws InterruptedException, JsonProcessingException {
+ adminClient.login();
+ Thread.sleep(10000);
+ List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+ List<SelectorCacheData> selectorCacheList =
gatewayClient.getSelectorCache();
+ List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+ Assertions.assertEquals(1, selectorCacheList.size());
+ Assertions.assertEquals(5, metaDataCacheList.size());
+ Assertions.assertEquals(5, ruleCacheList.size());
+ }
+}
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynNacosTest.java
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynNacosTest.java
new file mode 100644
index 000000000..73785448f
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynNacosTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.e2e.testcase.motan;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest.Parameter;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Nacos data synchronization method.
+ */
+@ShenYuTest(
+ mode = ShenYuEngineConfigure.Mode.DOCKER,
+ services = {
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "admin",
+ port = 9095,
+ baseUrl = "http://{hostname:localhost}:9095",
+ parameters = {
+ @Parameter(key = "username", value = "admin"),
+ @Parameter(key = "password", value = "123456"),
+ @Parameter(key = "dataSyn", value = "nacos")
+ }
+ ),
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "gateway",
+ port = 9195,
+ baseUrl = "http://{hostname:localhost}:9195",
+ type =
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+ parameters = {
+ @Parameter(key = "dataSyn", value = "nacos")
+ }
+ )
+ },
+ dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynNacosTest {
+
+ @Test
+ void testDataSyn(final AdminClient adminClient, final GatewayClient
gatewayClient) throws InterruptedException, JsonProcessingException {
+ adminClient.login();
+ Thread.sleep(10000);
+ List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+ List<SelectorCacheData> selectorCacheList =
gatewayClient.getSelectorCache();
+ List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+ Assertions.assertEquals(1, selectorCacheList.size());
+ Assertions.assertEquals(5, metaDataCacheList.size());
+ Assertions.assertEquals(5, ruleCacheList.size());
+ }
+}
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynZookeeperTest.java
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynZookeeperTest.java
new file mode 100644
index 000000000..22a031ce9
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/DataSynZookeeperTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.e2e.testcase.motan;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * Testing the correctness of Apollo data synchronization method.
+ */
+@ShenYuTest(
+ mode = ShenYuEngineConfigure.Mode.DOCKER,
+ services = {
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "admin",
+ port = 9095,
+ baseUrl = "http://{hostname:localhost}:9095",
+ parameters = {
+ @ShenYuTest.Parameter(key = "username", value
= "admin"),
+ @ShenYuTest.Parameter(key = "password", value
= "123456"),
+ @ShenYuTest.Parameter(key = "dataSyn", value =
"zookeeper")
+ }
+ ),
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "gateway",
+ port = 9195,
+ baseUrl = "http://{hostname:localhost}:9195",
+ type =
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+ parameters = {
+ @ShenYuTest.Parameter(key = "dataSyn", value =
"zookeeper")
+ }
+ )
+ },
+ dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+public class DataSynZookeeperTest {
+
+ @Test
+ void testDataSyn(final AdminClient adminClient, final GatewayClient
gatewayClient) throws InterruptedException, JsonProcessingException {
+ adminClient.login();
+ Thread.sleep(10000);
+ List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+ List<SelectorCacheData> selectorCacheList =
gatewayClient.getSelectorCache();
+ List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+ Assertions.assertEquals(1, selectorCacheList.size());
+ Assertions.assertEquals(5, metaDataCacheList.size());
+ Assertions.assertEquals(5, ruleCacheList.size());
+ }
+
+}
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java
similarity index 71%
copy from
shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java
copy to
shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java
index 987f73c3c..86d090169 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shenyu.e2e.testcase.sofa;
+package org.apache.shenyu.e2e.testcase.motan;
import com.google.common.collect.Lists;
import io.restassured.http.Method;
@@ -27,6 +27,7 @@ import
org.apache.shenyu.e2e.engine.scenario.specification.ShenYuCaseSpec;
import org.apache.shenyu.e2e.engine.scenario.specification.ShenYuScenarioSpec;
import org.apache.shenyu.e2e.model.Plugin;
import org.apache.shenyu.e2e.model.data.Condition;
+import org.apache.shenyu.e2e.model.handle.DivideRuleHandle;
import java.util.List;
@@ -37,7 +38,7 @@ import static
org.apache.shenyu.e2e.template.ResourceDataTemplate.newConditions;
import static
org.apache.shenyu.e2e.template.ResourceDataTemplate.newRuleBuilder;
import static
org.apache.shenyu.e2e.template.ResourceDataTemplate.newSelectorBuilder;
-public class SofaPluginCases implements ShenYuScenarioProvider {
+public class MotanPluginCases implements ShenYuScenarioProvider {
@Override
public List<ScenarioSpec> get() {
@@ -60,28 +61,30 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithUriEquals() {
return ShenYuScenarioSpec.builder()
- .name("single-sofa uri =]")
+ .name("single-motan uri =]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
-
.conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/sofa/findAll"))
+ newSelectorBuilder("selector",
Plugin.MOTAN)
+
.conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi"))
.build(),
newRuleBuilder("rule")
-
.conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/sofa/findAll"))
+
.conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi"))
+
.handle(DivideRuleHandle.builder().timeout(100000).retry(10).build())
.build()
)
- .checker(notExists("/sofa/findAll"))
- .waiting(exists("/sofa/findAll"))
+ .checker(notExists("/motan/demo/hi"))
+ .waiting(exists("/motan/demo/hi"))
.build()
)
.caseSpec(
ShenYuCaseSpec.builder()
- .addExists("/sofa/findAll")
- .addNotExists("/sofa/fin")
+ .addExists("/motan/demo/hi")
+ .addNotExists("/motan/demo/h")
.addNotExists("/put")
.addNotExists("/get")
- .build())
+ .build()
+ )
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
}
@@ -93,27 +96,27 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithUriPathPattern() {
return ShenYuScenarioSpec.builder()
- .name("single-sofa uri path_pattern]")
+ .name("single-motan uri path_pattern]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
-
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.PATH_PATTERN, "/sofa/**"))
+ newSelectorBuilder("selector",
Plugin.MOTAN)
+
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.PATH_PATTERN, "/motan/demo/**"))
.build(),
newRuleBuilder("rule")
-
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.PATH_PATTERN, "/sofa/**"))
+
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.PATH_PATTERN, "/motan/demo/**"))
.build()
)
- .checker(notExists("/sofa/findAll"))
- .waiting(exists("/sofa/findAll"))
+ .checker(notExists("/motan/demo/hi"))
+ .waiting(exists("/motan/demo/hi"))
.build()
).caseSpec(
ShenYuCaseSpec.builder()
- .addExists("/sofa/findAll")
- .addNotExists("/sof")
- .addExists(Method.POST, "/sofa/findAll")
- .addExists(Method.PUT, "/sofa/findAll")
- .addExists(Method.DELETE, "/sofa/findAll")
+ .addExists("/motan/demo/hi")
+ .addNotExists("/motan/de")
+ .addExists(Method.POST, "/motan/demo/hi")
+ .addExists(Method.PUT, "/motan/demo/hi")
+ .addExists(Method.DELETE, "/motan/demo/hi")
.build())
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
@@ -126,28 +129,28 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithUriStartWith() {
return ShenYuScenarioSpec.builder()
- .name("single-sofa uri starts_with]")
+ .name("single-motan uri starts_with]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
-
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.STARTS_WITH, "/sofa/"))
+ newSelectorBuilder("selector",
Plugin.MOTAN)
+
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.STARTS_WITH, "/motan/"))
.build(),
newRuleBuilder("rule")
-
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.STARTS_WITH, "/sofa/"))
+
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.STARTS_WITH, "/motan/"))
.build()
)
- .checker(notExists("/sofa/findAll"))
- .waiting(exists("/sofa/findAll"))
+ .checker(notExists("/motan/demo/hi"))
+ .waiting(exists("/motan/demo/hi"))
.build()
)
.caseSpec(
ShenYuCaseSpec.builder()
- .addExists("/sofa/findAll")
- .addNotExists("/sofa/de")
- .addExists(Method.POST, "/sofa/findAll")
- .addExists(Method.PUT, "/sofa/findAll")
- .addExists(Method.DELETE, "/sofa/findAll")
+ .addExists("/motan/demo/hi")
+ .addNotExists("/mota/")
+ .addExists(Method.POST, "/motan/demo/hi")
+ .addExists(Method.PUT, "/motan/demo/hi")
+ .addExists(Method.DELETE, "/motan/demo/hi")
.build())
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
@@ -160,28 +163,28 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithEndWith() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri ends_with]")
+ .name("single-motan uri ends_with]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
-
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.ENDS_WITH, "/findAll"))
+ newSelectorBuilder("selector",
Plugin.MOTAN)
+
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.ENDS_WITH, "/hi"))
.build(),
newRuleBuilder("rule")
-
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.ENDS_WITH, "/findAll"))
+
.conditionList(newConditions(Condition.ParamType.URI,
Condition.Operator.ENDS_WITH, "/hi"))
.build()
)
- .checker(notExists("/sofa/findAll"))
- .waiting(exists("/sofa/findAll"))
+ .checker(notExists("/motan/demo/hi"))
+ .waiting(exists("/motan/demo/hi"))
.build()
)
.caseSpec(
ShenYuCaseSpec.builder()
- .addExists("/sofa/findAll")
- .addNotExists("/sofa/find")
- .addExists(Method.POST, "/sofa/findAll")
- .addExists(Method.PUT, "/sofa/findAll")
- .addExists(Method.DELETE, "/sofa/findAll")
+ .addExists("/motan/demo/hi")
+ .addNotExists("/motan/demo/h")
+ .addExists(Method.POST, "/motan/demo/hi")
+ .addExists(Method.PUT, "/motan/demo/hi")
+ .addExists(Method.DELETE, "/motan/demo/hi")
.build())
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
@@ -194,34 +197,34 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodGet() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method GET]")
+ .name("single-motan uri method GET]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
+ newSelectorBuilder("selector",
Plugin.MOTAN)
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "GET"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build(),
newRuleBuilder("rule")
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "GET"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build()
)
- .checker(notExists(Method.GET,
"/sofa/findAll"))
- .waiting(exists(Method.GET, "/sofa/findAll"))
+ .checker(notExists(Method.GET,
"/motan/demo/hi"))
+ .waiting(exists(Method.GET, "/motan/demo/hi"))
.build()
)
.caseSpec(
ShenYuCaseSpec.builder()
- .addExists(Method.GET, "/sofa/findAll")
- .addNotExists(Method.GET, "/sofa/find")
- .addNotExists(Method.POST, "/sofa/findAll")
- .addNotExists(Method.PUT, "/sofa/findAll")
- .addNotExists(Method.DELETE, "/sofa/findAll")
+ .addExists(Method.GET, "/motan/demo/hi")
+ .addNotExists(Method.GET, "/motan/demo/h")
+ .addNotExists(Method.POST, "/motan/demo/hi")
+ .addNotExists(Method.PUT, "/motan/demo/hi")
+ .addNotExists(Method.DELETE, "/motan/demo/hi")
.build())
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
@@ -234,34 +237,34 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodPost() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method POST]")
+ .name("single-motan uri method POST]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
+ newSelectorBuilder("selector",
Plugin.MOTAN)
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "POST"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build(),
newRuleBuilder("rule")
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "POST"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build()
)
- .checker(notExists(Method.POST,
"/sofa/findAll"))
- .waiting(exists(Method.POST, "/sofa/findAll"))
+ .checker(notExists(Method.POST,
"/motan/demo/hi"))
+ .waiting(exists(Method.POST, "/motan/demo/hi"))
.build()
)
.caseSpec(
ShenYuCaseSpec.builder()
- .addExists(Method.POST, "/sofa/findAll")
- .addNotExists(Method.POST, "/sofa/find")
- .addNotExists(Method.GET, "/sofa/findAll")
- .addNotExists(Method.PUT, "/sofa/findAll")
- .addNotExists(Method.DELETE, "/sofa/findAll")
+ .addExists(Method.POST, "/motan/demo/hi")
+ .addNotExists(Method.POST, "/motan/demo/h")
+ .addNotExists(Method.GET, "/motan/demo/hi")
+ .addNotExists(Method.PUT, "/motan/demo/hi")
+ .addNotExists(Method.DELETE, "/motan/demo/hi")
.build())
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
@@ -274,39 +277,40 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodPut() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method PUT]")
+ .name("single-motan uri method PUT]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
+ newSelectorBuilder("selector",
Plugin.MOTAN)
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "PUT"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build(),
newRuleBuilder("rule")
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "PUT"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build()
)
- .checker(notExists(Method.PUT,
"/sofa/findAll"))
- .waiting(exists(Method.PUT, "/sofa/findAll"))
+ .checker(notExists(Method.PUT,
"/motan/demo/hi"))
+ .waiting(exists(Method.PUT, "/motan/demo/hi"))
.build()
)
.caseSpec(
ShenYuCaseSpec.builder()
- .addExists(Method.PUT, "/sofa/findAll")
- .addNotExists(Method.PUT, "/sofa/find")
- .addNotExists(Method.GET, "/sofa/findAll")
- .addNotExists(Method.POST, "/sofa/findAll")
- .addNotExists(Method.DELETE, "/sofa/findAll")
+ .addExists(Method.PUT, "/motan/demo/hi")
+ .addNotExists(Method.PUT, "/motan/demo/h")
+ .addNotExists(Method.GET, "/motan/demo/hi")
+ .addNotExists(Method.POST, "/motan/demo/hi")
+ .addNotExists(Method.DELETE, "/motan/demo/hi")
.build())
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
}
+
/**
* test with uri method delete.
*
@@ -314,34 +318,34 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodDelete() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method DELETE]")
+ .name("single-motan uri method DELETE]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
- newSelectorBuilder("selector",
Plugin.SOFA)
+ newSelectorBuilder("selector",
Plugin.MOTAN)
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "DELETE"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build(),
newRuleBuilder("rule")
.conditionList(Lists.newArrayList(
newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "DELETE"),
-
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")
+
newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL,
"/motan/demo/hi")
))
.build()
)
- .checker(notExists(Method.DELETE,
"/sofa/findAll"))
- .waiting(exists(Method.DELETE,
"/sofa/findAll"))
+ .checker(notExists(Method.DELETE,
"/motan/demo/hi"))
+ .waiting(exists(Method.DELETE,
"/motan/demo/hi"))
.build()
)
.caseSpec(
ShenYuCaseSpec.builder()
- .addExists(Method.DELETE, "/sofa/findAll")
- .addNotExists(Method.DELETE, "/sofa/find")
- .addNotExists(Method.GET, "/sofa/findAll")
- .addNotExists(Method.POST, "/sofa/findAll")
- .addNotExists(Method.PUT, "/sofa/findAll")
+ .addExists(Method.DELETE, "/motan/demo/hi")
+ .addNotExists(Method.DELETE, "/motan/demo/h")
+ .addNotExists(Method.GET, "/motan/demo/hi")
+ .addNotExists(Method.POST, "/motan/demo/hi")
+ .addNotExists(Method.PUT, "/motan/demo/hi")
.build())
.afterEachSpec(ShenYuAfterEachSpec.DEFAULT)
.build();
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java
new file mode 100644
index 000000000..be8486a89
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java
@@ -0,0 +1,154 @@
+/*
+ * 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.e2e.testcase.motan;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import io.restassured.RestAssured;
+import io.restassured.parsing.Parser;
+import org.apache.shenyu.e2e.client.admin.AdminClient;
+import org.apache.shenyu.e2e.client.gateway.GatewayClient;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuScenario;
+import org.apache.shenyu.e2e.engine.annotation.ShenYuTest;
+import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure;
+import org.apache.shenyu.e2e.engine.scenario.specification.AfterEachSpec;
+import org.apache.shenyu.e2e.engine.scenario.specification.BeforeEachSpec;
+import org.apache.shenyu.e2e.engine.scenario.specification.CaseSpec;
+import org.apache.shenyu.e2e.model.ResourcesData;
+import org.apache.shenyu.e2e.model.data.MetaData;
+import org.apache.shenyu.e2e.model.data.RuleCacheData;
+import org.apache.shenyu.e2e.model.data.SelectorCacheData;
+import org.apache.shenyu.e2e.model.response.MetaDataDTO;
+import org.apache.shenyu.e2e.model.response.RuleDTO;
+import org.apache.shenyu.e2e.model.response.SelectorDTO;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.testcontainers.shaded.com.google.common.collect.Lists;
+
+import java.util.List;
+
+@ShenYuTest(
+ mode = ShenYuEngineConfigure.Mode.DOCKER,
+ services = {
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "admin",
+ port = 9095,
+ baseUrl = "http://{hostname:localhost}:9095",
+ parameters = {
+ @ShenYuTest.Parameter(key = "username", value
= "admin"),
+ @ShenYuTest.Parameter(key = "password", value
= "123456"),
+ @ShenYuTest.Parameter(key = "dataSyn", value =
"admin_websocket")
+ }
+ ),
+ @ShenYuTest.ServiceConfigure(
+ serviceName = "gateway",
+ port = 9195,
+ baseUrl = "http://{hostname:localhost}:9195",
+ type =
ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY,
+ parameters = {
+ @ShenYuTest.Parameter(key = "dataSyn", value =
"gateway_websocket")
+ }
+ )
+ },
+ dockerComposeFile = "classpath:./docker-compose.mysql.yml"
+)
+/**
+ * Testing spring-cloud plugin.
+ */
+public class MotanPluginTest {
+ private List<String> selectorIds = Lists.newArrayList();
+
+ @BeforeAll
+ static void setup(final AdminClient adminClient, final GatewayClient
gatewayClient) throws InterruptedException, JsonProcessingException {
+ adminClient.login();
+ Thread.sleep(10000);
+ List<SelectorDTO> selectorDTOList = adminClient.listAllSelectors();
+ List<MetaDataDTO> metaDataDTOList = adminClient.listAllMetaData();
+ List<RuleDTO> ruleDTOList = adminClient.listAllRules();
+ Assertions.assertEquals(1, selectorDTOList.size());
+ Assertions.assertEquals(5, metaDataDTOList.size());
+ Assertions.assertEquals(5, ruleDTOList.size());
+
+ List<MetaData> metaDataCacheList = gatewayClient.getMetaDataCache();
+ List<SelectorCacheData> selectorCacheList =
gatewayClient.getSelectorCache();
+ List<RuleCacheData> ruleCacheList = gatewayClient.getRuleCache();
+ Assertions.assertEquals(1, selectorCacheList.size());
+ Assertions.assertEquals(5, metaDataCacheList.size());
+ Assertions.assertEquals(5, ruleCacheList.size());
+
+ MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
+ formData.add("id", "17");
+ formData.add("name", "motan");
+ formData.add("enabled", "true");
+ formData.add("role", "Proxy");
+ formData.add("sort", "310");
+ formData.add("config", "{\"registerProtocol\":\"zk\",
\"registerAddress\":\"zookeeper:2181\"}");
+ adminClient.changePluginStatus("17", formData);
+ adminClient.deleteAllSelectors();
+ selectorDTOList = adminClient.listAllSelectors();
+ Assertions.assertEquals(0, selectorDTOList.size());
+ RestAssured.registerParser("text/plain", Parser.JSON);
+ }
+
+ @BeforeEach
+ void before(final AdminClient client, final GatewayClient gateway, final
BeforeEachSpec spec) {
+ spec.getChecker().check(gateway);
+
+ ResourcesData resources = spec.getResources();
+ for (ResourcesData.Resource res : resources.getResources()) {
+ SelectorDTO dto = client.create(res.getSelector());
+ selectorIds.add(dto.getId());
+
+ res.getRules().forEach(rule -> {
+ rule.setSelectorId(dto.getId());
+ client.create(rule);
+ });
+ }
+
+ spec.getWaiting().waitFor(gateway);
+ }
+
+ @ShenYuScenario(provider = MotanPluginCases.class)
+ void testMotan(final GatewayClient gateway, final CaseSpec spec) {
+ spec.getVerifiers().forEach(verifier ->
verifier.verify(gateway.getHttpRequesterSupplier().get()));
+ }
+
+ @AfterEach
+ void after(final AdminClient client, final GatewayClient gateway, final
AfterEachSpec spec) {
+ spec.getDeleter().delete(client, selectorIds);
+ spec.getPostChecker().check(gateway);
+ selectorIds = Lists.newArrayList();
+ }
+
+ @AfterAll
+ static void teardown(final AdminClient client) {
+ client.deleteAllSelectors();
+ MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
+ formData.add("id", "17");
+ formData.add("name", "motan");
+ formData.add("enabled", "false");
+ formData.add("role", "Proxy");
+ formData.add("sort", "310");
+ client.changePluginStatus("17", formData);
+ }
+}
+
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/admin-application.yml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/admin-application.yml
new file mode 100755
index 000000000..504485f9f
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/admin-application.yml
@@ -0,0 +1,119 @@
+# 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: 9095
+ address: 0.0.0.0
+
+spring:
+ profiles:
+ active: h2
+ thymeleaf:
+ cache: true
+ encoding: utf-8
+ enabled: true
+ prefix: classpath:/static/
+ suffix: .html
+ mvc:
+ pathmatch:
+ matching-strategy: ant_path_matcher
+ jackson:
+ time-zone: GMT+8 # GMT , Asia/Shanghai
+ messages:
+ basename: message/i18n
+
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - 'health'
+ - 'prometheus'
+ enabled-by-default: true
+
+mybatis:
+ config-location: classpath:/mybatis/mybatis-config.xml
+ mapper-locations: classpath:/mappers/*.xml
+
+shenyu:
+ register:
+ registerType: http #http #zookeeper #etcd #nacos #consul
+ serverLists: #localhost:2181 #http://localhost:2379 #localhost:8848
+ props:
+ sessionTimeout: 5000
+ connectionTimeout: 2000
+ checked: true
+ zombieCheckThreads: 10
+ zombieCheckTimes: 5
+ scheduledTime: 10
+ nacosNameSpace: ShenyuRegisterCenter
+ sync:
+ websocket:
+ enabled: true
+ messageMaxSize: 10240
+ allowOrigins: ws://localhost:9095;ws://localhost:9195;
+ ldap:
+ enabled: false
+ url: ldap://xxxx:xxx
+ bind-dn: cn=xxx,dc=xxx,dc=xxx
+ password: xxxx
+ base-dn: ou=xxx,dc=xxx,dc=xxx
+ object-class: person
+ login-field: cn
+ jwt:
+ expired-seconds: 86400000
+ shiro:
+ white-list:
+ - /
+ - /favicon.*
+ - /static/**
+ - /index**
+ - /platform/login
+ - /websocket
+ - /error
+ - /actuator/health
+ - /actuator/health/** # /actuator/health/readiness
/actuator/health/liveness
+ - /actuator/prometheus
+ - /swagger-ui.html
+ - /webjars/**
+ - /swagger-resources/**
+ - /v2/api-docs
+ - /csrf
+ swagger:
+ enable: true
+ dashboard:
+ core:
+ onlySuperAdminPermission:
+ - system:manager:add
+ - system:manager:edit
+ - system:manager:delete
+ - system:role:add
+ - system:role:edit
+ - system:role:delete
+ - system:resource:addButton
+ - system:resource:addMenu
+ - system:resource:editButton
+ - system:resource:editMenu
+ - system:resource:deleteButton
+ - system:resource:deleteMenu
+
+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-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/bootstrap-application.yml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/bootstrap-application.yml
new file mode 100644
index 000000000..74c817c46
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/bootstrap-application.yml
@@ -0,0 +1,200 @@
+# 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
+ codec:
+ max-in-memory-size: 2MB
+ cloud:
+ discovery:
+ enabled: false
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848 # Spring Cloud Alibaba Dubbo use this.
+ enabled: false
+ namespace: ShenyuRegisterCenter
+
+eureka:
+ client:
+ enabled: false
+ serviceUrl:
+ defaultZone: http://localhost:8761/eureka/
+ instance:
+ prefer-ip-address: true
+
+management:
+ health:
+ redis:
+ enabled: false
+ elasticsearch:
+ enabled: false
+ endpoint:
+ health:
+ enabled: true
+ show-details: always
+ endpoints:
+ web:
+ exposure:
+ include: "*" # or health,info
+
+
+shenyu:
+ selectorMatchCache:
+ cache:
+ enabled: false
+ initialCapacity: 10000 # initial capacity in cache
+ maximumSize: 10000 # max size in cache
+ trie:
+ enabled: false
+ cacheSize: 128 # the number of plug-ins
+ matchMode: antPathMatch
+ ruleMatchCache:
+ cache:
+ enabled: true
+ initialCapacity: 10000 # initial capacity in cache
+ maximumSize: 65536 # max size in cache
+ trie:
+ enabled: false
+ cacheSize: 1024 # the number of selectors
+ matchMode: antPathMatch
+ netty:
+ http:
+ webServerFactoryEnabled: true
+ selectCount: 1
+ workerCount: 8
+ 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
+ sni:
+ enabled: false
+ mod: k8s #manul
+ defaultK8sSecretNamespace: shenyu-ingress
+ defaultK8sSecretName: default-cert
+ register:
+ enabled: false
+ 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
+ collapseSlashes: false
+ file:
+ enabled: true
+ maxSize : 10
+ sync:
+ websocket:
+ urls: ws://localhost:9095/websocket
+ allowOrigin: ws://localhost:9195
+ exclude:
+ enabled: false
+ paths:
+ - /favicon.ico
+ fallback:
+ enabled: false
+ paths:
+ - /fallback/hystrix
+ - /fallback/resilience4j
+ - /fallback/sentinel
+ health:
+ enabled: true
+ paths:
+ - /actuator
+ - /health_check
+ extPlugin:
+ path:
+ enabled: true
+ threads: 1
+ scheduleTime: 300
+ scheduleDelay: 30
+ scheduler:
+ enabled: false
+ type: fixed
+ threads: 16
+ upstreamCheck:
+ enabled: false
+ poolSize: 10
+ timeout: 3000
+ healthyThreshold: 1
+ unhealthyThreshold: 1
+ interval: 5000
+ printEnabled: true
+ printInterval: 60000
+ springCloudCache:
+ enabled: false
+ ribbon:
+ serverListRefreshInterval: 10000
+ metrics:
+ enabled: false
+ name : prometheus
+ host: 127.0.0.1
+ port: 8090
+ jmxConfig:
+ props:
+ jvm_enabled: true
+ 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-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/docker-compose.mysql.yml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/docker-compose.mysql.yml
new file mode 100644
index 000000000..2a2146d07
--- /dev/null
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/resources/docker-compose.mysql.yml
@@ -0,0 +1,125 @@
+#
+# 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: '2.3'
+
+services:
+ zookeeper:
+ image: zookeeper:3.8.0
+ restart: always
+ expose:
+ - 2181
+ healthcheck:
+ test: [ "CMD", "curl", "-f", "http://localhost:8080/commands/stat" ]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ start_period: 40s
+
+ nacos:
+ image: nacos/nacos-server:v2.2.3
+ environment:
+ - TZ=Asia/Shanghai
+ - MODE=standalone
+ expose:
+ - 8848
+ - 9848
+ - 9849
+ healthcheck:
+ test: [ "CMD", "curl", "-f",
"http://localhost:8848/nacos/actuator/health" ]
+ interval: 10s
+ timeout: 5s
+ retries: 3
+ start_period: 30s
+
+ admin:
+ image: shenyu/admin:latest
+ expose:
+ - 9095
+ ports:
+ - "9095:9095"
+ depends_on:
+ zookeeper:
+ condition: service_started
+ nacos:
+ condition: service_started
+ mysql:
+ condition: service_started
+ volumes:
+ -
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
+ -
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
+ environment:
+ - SPRING_PROFILES_ACTIVE=mysql
+ - spring.datasource.username=shenyue2e
+ - spring.datasource.password=123456
+ -
spring.datasource.url=jdbc:mysql://mysql:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+ healthcheck:
+ test: [ "CMD-SHELL", "wget -q -O - http://admin:9095/actuator/health |
grep UP || exit 1" ]
+ timeout: 2s
+ retries: 3
+ start_period: 10s
+
+ motan:
+ image: shenyu-examples-motan:latest
+ restart: always
+ environment:
+ - motan.registry.protocol=zookeeper
+ - motan.registry.address=zookeeper:2181
+ - shenyu.register.serverLists=http://admin:9095
+ healthcheck:
+ test: [ "CMD-SHELL", "wget -q -O - http://localhost:8081/actuator/health
| grep UP || exit 1" ]
+ timeout: 2s
+ retries: 3
+ start_period: 5s
+ ports:
+ - "8081:8081"
+ - "8002:8002"
+ depends_on:
+ admin:
+ condition: service_healthy
+
+ gateway:
+ image: shenyu/bootstrap:latest
+ expose:
+ - 9195
+ ports:
+ - "9195:9195"
+ depends_on:
+ motan:
+ condition: service_healthy
+ volumes:
+ -
../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml
+ healthcheck:
+ test: [ "CMD", "wget", "-q", "-O", "-",
"http://gateway:9195/actuator/health" ]
+ timeout: 2s
+ retries: 3
+ start_period: 5s
+
+ mysql:
+ image: mysql:8
+ environment:
+ - MYSQL_ROOT_PASSWORD=123123
+ - MYSQL_USER=shenyue2e
+ - MYSQL_PASSWORD=123456
+ healthcheck:
+ test: "/usr/bin/mysql --user=root --password=123123 --execute \"SHOW
DATABASES;\""
+ interval: 2s
+ timeout: 20s
+ retries: 10
+ start_period: 60s
+ volumes:
+ - /tmp/shenyu-e2e/mysql/schema.sql:/docker-entrypoint-initdb.d/schema.sql
\ No newline at end of file
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java
index 987f73c3c..c4fa9da3c 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java
@@ -160,7 +160,7 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithEndWith() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri ends_with]")
+ .name("single-sofa uri ends_with]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
@@ -194,7 +194,7 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodGet() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method GET]")
+ .name("single-sofa uri method GET]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
@@ -234,7 +234,7 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodPost() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method POST]")
+ .name("single-sofa uri method POST]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
@@ -274,7 +274,7 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodPut() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method PUT]")
+ .name("single-sofa uri method PUT]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
@@ -314,7 +314,7 @@ public class SofaPluginCases implements
ShenYuScenarioProvider {
*/
public ShenYuScenarioSpec testWithMethodDelete() {
return ShenYuScenarioSpec.builder()
- .name("single-alibaba-sofa uri method DELETE]")
+ .name("single-sofa uri method DELETE]")
.beforeEachSpec(
ShenYuBeforeEachSpec.builder()
.addSelectorAndRule(
diff --git
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java
index 38058c374..05e70210e 100644
---
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java
+++
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java
@@ -25,6 +25,12 @@ import com.weibo.api.motan.transport.async.MotanAsync;
@MotanAsync
public interface MotanDemoService {
+ /**
+ * hi demo for Motan.
+ * @return response
+ */
+ String hi();
+
/**
* hello demo for Motan.
* @param name the name to hello
diff --git
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
index be0a28c2c..6cd3bbe63 100644
---
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
+++
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
@@ -35,6 +35,14 @@ import
org.apache.shenyu.springboot.starter.client.motan.ShenyuMotanClientConfig
@ApiModule("MotanDemoService")
public class MotanDemoServiceImpl implements MotanDemoService {
+ @Override
+ @ShenyuMotanClient(value = "/hi")
+ @Log
+ @ApiDoc(desc = "hi")
+ public String hi() {
+ return "{\"say\":\"hi\"}";
+ }
+
@Override
@ShenyuMotanClient(value = "/hello")
@Log