You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/06/16 13:58:07 UTC
[incubator-shenyu] branch master updated: fix issue #3521,add integration test in shenyu-integrated-test-sofa (#3572)
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 0335efe38 fix issue #3521,add integration test in shenyu-integrated-test-sofa (#3572)
0335efe38 is described below
commit 0335efe38e2a22687890a0f6abebed859201104c
Author: ShawnSiao <xi...@qq.com>
AuthorDate: Thu Jun 16 21:57:59 2022 +0800
fix issue #3521,add integration test in shenyu-integrated-test-sofa (#3572)
---
.../src/main/resources/application-local.yml | 2 +
.../test/sofa/SofaPluginShareThreadPoolTest.java | 48 ++++++++++++++++++++++
2 files changed, 50 insertions(+)
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
index 3ad9801f4..e26257395 100644
--- 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
@@ -44,6 +44,8 @@ shenyu:
local:
enabled: true
sha512Key: "BA3253876AED6BC22D4A6FF53D8406C6AD864195ED144AB5C87621B6C233B548BAEAE6956DF346EC8C17F5EA10F35EE3CBC514797ED7DDD3145464E2A0BAB413"
+ sharedPool:
+ enable: true
logging:
level:
diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginShareThreadPoolTest.java b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginShareThreadPoolTest.java
new file mode 100644
index 000000000..9ae9b2351
--- /dev/null
+++ b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginShareThreadPoolTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.common.enums.PluginEnum;
+import org.apache.shenyu.integrated.test.sofa.dto.SofaTestData;
+import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit;
+import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
+import org.hamcrest.Matchers;
+import org.hamcrest.core.Is;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class SofaPluginShareThreadPoolTest extends AbstractPluginDataInit {
+
+ @BeforeAll
+ public static void setup() throws IOException {
+ String pluginResult = initPlugin(PluginEnum.SOFA.getName(), "{\"protocol\":\"zookeeper\",\"register\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}");
+ assertThat(pluginResult, Matchers.is("success"));
+ }
+
+ @Test
+ public void testHelloWorld() throws IOException {
+ SofaTestData response = HttpHelper.INSTANCE.getFromGateway("/sofa/findById?id=1001", new TypeToken<SofaTestData>() { }.getType());
+ assertThat(response.getName(), Is.is("hello world shenyu Sofa, findById"));
+ assertThat(response.getId(), Is.is("1001"));
+ }
+
+}