You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by so...@apache.org on 2024/08/17 05:00:17 UTC
(dubbo-spi-extensions) branch master updated: Merge master (#471)
This is an automated email from the ASF dual-hosted git repository.
songxiaosheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-spi-extensions.git
The following commit(s) were added to refs/heads/master by this push:
new 681c545b Merge master (#471)
681c545b is described below
commit 681c545bc95d4432bc63733002f3585f30b25b2f
Author: xiaosheng <so...@apache.org>
AuthorDate: Sat Aug 17 13:00:12 2024 +0800
Merge master (#471)
* :arrow_up: webservice upgrade dubbo3.2
* :arrow_up: webservice upgrade dubbo3.2
* [Dubbo-267] Fix protobuf type lose field when deepCopy inJvmInvoker Class. (#268)
* ⬆️ webservice upgrade dubbo3.2 (#269)
* :arrow_up: webservice upgrade dubbo3.2
* :arrow_up: webservice upgrade dubbo3.2
* :arrow_up: rpc redis upgrade dubbo3.2
* ⬆️ upgrade dubbo version in rpc rmi (#276)
* Bump org.apache.avro:avro in /dubbo-extensions-dependencies-bom (#252)
Bumps org.apache.avro:avro from 1.8.2 to 1.11.3.
---
updated-dependencies:
- dependency-name: org.apache.avro:avro
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <su...@github.com>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
Co-authored-by: xiaosheng <so...@apache.org>
* :arrow_up: webservice upgrade dubbo3.2
* :arrow_up: webservice upgrade dubbo3.2
* Update NOTICE to 2024
* :arrow_up: upgrade dubbo version in rpc rmi
---------
Signed-off-by: dependabot[bot] <su...@github.com>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
Co-authored-by: Albumen Kevin <jh...@gmail.com>
* :arrow_up: upgrade dubbo version in thrift
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9 fix rpc rocketmq
* :arrow_up: opt dubbo version to 3.2.9 opt dubbo-mock-admin
* :arrow_up: opt dubbo version to 3.2.9 disable redis test
* :arrow_up: dubbo version to 3.2.x,spi version to 3.2.0
* :arrow_up: dubbo version to 3.2.x,spi version to 3.2.0
* :arrow_up: dubbo version to 3.2.x,spi version to 3.2.0
* :arrow_up: dubbo version to 3.2.x,fix dubbo-gateway-provider
* :arrow_up: version to 3.2.x,
* :arrow_up: version to 3.2.x fix fastjson test bug
* :arrow_up: dubbo version to 3.2.x
* :arrow_up: dubbo version to 3.2.x remove unused import
* :arrow_up: upgrade spring-test version
* :test_tube: fix etcd test in pr error
* :arrow_up: opt JSON to JsonUtils
* ⬆️ upgrade all dubbo version to 3.2.x (#278)
* :arrow_up: webservice upgrade dubbo3.2
* :arrow_up: webservice upgrade dubbo3.2
* :arrow_up: rpc redis upgrade dubbo3.2
* :arrow_up: upgrade dubbo version in thrift
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9
* :arrow_up: opt dubbo version to 3.2.9 fix rpc rocketmq
* :arrow_up: opt dubbo version to 3.2.9 opt dubbo-mock-admin
* :arrow_up: opt dubbo version to 3.2.9 disable redis test
* :arrow_up: dubbo version to 3.2.x,spi version to 3.2.0
* :arrow_up: dubbo version to 3.2.x,spi version to 3.2.0
* :arrow_up: dubbo version to 3.2.x,spi version to 3.2.0
* :arrow_up: dubbo version to 3.2.x,fix dubbo-gateway-provider
* :arrow_up: version to 3.2.x,
* :arrow_up: version to 3.2.x fix fastjson test bug
* :arrow_up: dubbo version to 3.2.x
* :arrow_up: dubbo version to 3.2.x remove unused import
* :arrow_up: upgrade spring-test version
* :test_tube: fix etcd test in pr error
* :arrow_up: opt JSON to JsonUtils
* :arrow_up: 3.2.0 release
* upgrade dubbo.version to 3.3.x
* remove test version
* fix embeddedzk
* fix rpc-rest
* test
* fix error
* fix timeout
* fix fastjson
* remove test module
* rename (#377)
* remove useless maven.compiler (#395)
* :memo: update 3.3 doc (#415)
* move jdk-serialize and add test cases (#417)
* move jdk-serialize and add test cases
* rename package
* repalce old license header
* restore Redundant renaming
* fix furcy core jar missing
* fix furcy core jar missing
* remove scenarios test to spi sample
* move test to spi sample
* move test to spi sample
---------
Signed-off-by: dependabot[bot] <su...@github.com>
Co-authored-by: MaruHibiki <18...@qq.com>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
Co-authored-by: Albumen Kevin <jh...@gmail.com>
Co-authored-by: Ken Liu <ke...@gmail.com>
Co-authored-by: 王聪洋 <16...@qq.com>
Co-authored-by: 王聪洋 <56...@users.noreply.github.com>
---
.github/workflows/conformance.yml | 20 -
README.md | 2 +-
README_CN.md | 2 +-
dubbo-api-docs/README.md | 4 +-
dubbo-api-docs/README_ch.md | 4 +-
.../examples-provider/pom.xml | 4 -
dubbo-extensions-dependencies-bom/pom.xml | 64 +-
.../gateway/provider/ConfigDeployListener.java | 4 +-
.../dubbo/registry/polaris/PolarisRegistry.java | 2 +-
dubbo-rpc-extensions/dubbo-rpc-hessian/pom.xml | 2 +-
.../dubbo-serialization-fury/pom.xml | 3 -
.../pom.xml | 27 +-
.../java/CompactedJavaSerialization.java} | 23 +-
.../serialize/java/CompactedObjectInputStream.java | 63 ++
.../java/CompactedObjectOutputStream.java} | 34 +-
.../common/serialize/java/JavaObjectInput.java | 89 +++
.../common/serialize/java/JavaObjectOutput.java | 61 ++
.../common/serialize/java/JavaSerialization.java | 82 +++
.../nativejava/NativeJavaObjectInput.java} | 89 +--
.../nativejava/NativeJavaObjectOutput.java} | 75 ++-
.../nativejava/NativeJavaSerialization.java | 83 +++
...org.apache.dubbo.common.serialize.Serialization | 3 +
.../apache/dubbo/common/serialize/jdk/Image.java | 120 ++++
.../common/serialize/jdk/JdkObjectOutputTest.java | 147 +++++
.../common/serialize/jdk/JdkSerializationTest.java | 63 ++
.../pom.xml | 2 +-
.../serialize/hessian/Hessian2ObjectInput.java | 0
.../serialize/hessian/Hessian2ObjectOutput.java | 0
.../serialize/hessian/Hessian2Serialization.java | 0
.../hessian/Hessian2SerializerFactory.java | 0
.../dubbo/AbstractHessian2FactoryInitializer.java | 0
.../dubbo/DefaultHessian2FactoryInitializer.java | 0
.../hessian/dubbo/Hessian2FactoryInitializer.java | 0
.../dubbo/WhitelistHessian2FactoryInitializer.java | 0
.../hessian/serializer/java8/DurationHandle.java | 0
.../hessian/serializer/java8/InstantHandle.java | 0
.../serializer/java8/Java8TimeSerializer.java | 0
.../hessian/serializer/java8/LocalDateHandle.java | 0
.../serializer/java8/LocalDateTimeHandle.java | 0
.../hessian/serializer/java8/LocalTimeHandle.java | 0
.../hessian/serializer/java8/MonthDayHandle.java | 0
.../serializer/java8/OffsetDateTimeHandle.java | 0
.../hessian/serializer/java8/OffsetTimeHandle.java | 0
.../hessian/serializer/java8/PeriodHandle.java | 0
.../hessian/serializer/java8/YearHandle.java | 0
.../hessian/serializer/java8/YearMonthHandle.java | 0
.../hessian/serializer/java8/ZoneIdHandle.java | 0
.../hessian/serializer/java8/ZoneIdSerializer.java | 0
.../hessian/serializer/java8/ZoneOffsetHandle.java | 0
.../serializer/java8/ZonedDateTimeHandle.java | 0
...org.apache.dubbo.common.serialize.Serialization | 0
...ialize.hessian.dubbo.Hessian2FactoryInitializer | 0
.../serialize/hessian/Java8TimeSerializerTest.java | 0
dubbo-serialization-extensions/pom.xml | 3 +-
pom.xml | 3 +-
test/build-test-image.sh | 8 -
test/dubbo-scenario-builder/pom.xml | 114 ----
.../scenario/builder/AbstractRunningGenerator.java | 67 ---
.../dubbo/scenario/builder/ConfigurationImpl.java | 655 ---------------------
.../apache/dubbo/scenario/builder/Constants.java | 28 -
.../builder/DockerComposeRunningGenerator.java | 60 --
.../apache/dubbo/scenario/builder/FileUtil.java | 39 --
.../dubbo/scenario/builder/IConfiguration.java | 51 --
.../scenario/builder/ScenarioBuilderMain.java | 28 -
.../builder/ScenarioRunningScriptGenerator.java | 25 -
.../exception/ConfigureFileNotFoundException.java | 23 -
.../builder/exception/GenerateFailedException.java | 21 -
.../scenario/builder/vo/CaseConfiguration.java | 91 ---
.../dubbo/scenario/builder/vo/DockerService.java | 171 ------
.../scenario/builder/vo/ServiceComponent.java | 284 ---------
.../resources/configs/app-builtin-zookeeper.yml | 61 --
.../resources/configs/app-external-zookeeper.yml | 65 --
.../src/main/resources/docker-compose.template | 93 ---
.../src/main/resources/logback.xml | 51 --
.../src/main/resources/scenario.sh | 228 -------
test/dubbo-test-runner/build.sh | 24 -
test/dubbo-test-runner/pom.xml | 110 ----
test/dubbo-test-runner/src/docker/Dockerfile | 61 --
test/dubbo-test-runner/src/docker/healthcheck.sh | 43 --
test/dubbo-test-runner/src/docker/run-dubbo-app.sh | 41 --
.../dubbo-test-runner/src/docker/run-dubbo-test.sh | 51 --
test/dubbo-test-runner/src/docker/run.sh | 50 --
test/dubbo-test-runner/src/docker/utils.sh | 108 ----
.../apache/dubbo/test/runner/ClassLoaderUtils.java | 62 --
.../test/runner/ClassloaderSurefireStarter.java | 80 ---
.../apache/dubbo/test/runner/TestRunnerMain.java | 243 --------
test/kill-tests.sh | 22 -
test/pom.xml | 49 --
test/run-tests.sh | 382 ------------
test/scenarios/pom.xml | 41 --
.../case-configuration.yml | 24 -
.../dubbo-serialization-avro-test/pom.xml | 157 -----
.../test/serialization/avro/AvroProvider.java | 38 --
.../test/serialization/avro/EmbeddedZooKeeper.java | 251 --------
.../src/main/resources/log4j.properties | 25 -
.../main/resources/spring/dubbo-demo-consumer.xml | 33 --
.../main/resources/spring/dubbo-demo-provider.xml | 35 --
.../src/test/java/DemoServiceIT.java | 63 --
.../case-configuration.yml | 24 -
.../dubbo-serialization-fastjson-test/pom.xml | 130 ----
.../serialization/fastjson/EmbeddedZooKeeper.java | 250 --------
.../serialization/fastjson/FastjsonProvider.java | 39 --
.../src/main/resources/log4j.properties | 25 -
.../main/resources/spring/dubbo-demo-consumer.xml | 33 --
.../main/resources/spring/dubbo-demo-provider.xml | 35 --
.../src/test/java/DemoServiceIT.java | 63 --
.../case-configuration.yml | 24 -
.../dubbo-serialization-fst-test/pom.xml | 164 ------
.../test/serialization/fst/EmbeddedZooKeeper.java | 250 --------
.../dubbo/test/serialization/fst/FstProvider.java | 38 --
.../src/main/resources/log4j.properties | 25 -
.../main/resources/spring/dubbo-demo-consumer.xml | 33 --
.../main/resources/spring/dubbo-demo-provider.xml | 35 --
.../src/test/java/DemoServiceIT.java | 63 --
.../case-configuration.yml | 24 -
.../dubbo-serialization-gson-test/pom.xml | 159 -----
.../test/serialization/gson/EmbeddedZooKeeper.java | 250 --------
.../test/serialization/gson/GsonProvider.java | 39 --
.../src/main/resources/log4j.properties | 25 -
.../main/resources/spring/dubbo-demo-consumer.xml | 33 --
.../main/resources/spring/dubbo-demo-provider.xml | 35 --
.../src/test/java/DemoServiceIT.java | 63 --
.../case-configuration.yml | 24 -
.../dubbo-serialization-kryo-test/pom.xml | 157 -----
.../test/serialization/kryo/EmbeddedZooKeeper.java | 250 --------
.../test/serialization/kryo/KryoProvider.java | 39 --
.../src/main/resources/log4j.properties | 25 -
.../main/resources/spring/dubbo-demo-consumer.xml | 33 --
.../main/resources/spring/dubbo-demo-provider.xml | 35 --
.../src/test/java/DemoServiceIT.java | 63 --
.../case-configuration.yml | 24 -
.../dubbo-serialization-protobuf-test/pom.xml | 204 -------
.../serialization/protobuf/DemoServiceImpl.java | 69 ---
.../serialization/protobuf/EmbeddedZooKeeper.java | 254 --------
.../serialization/protobuf/ProtobufProvider.java | 39 --
.../src/main/proto/DemoService.proto | 79 ---
.../src/main/resources/log4j.properties | 25 -
.../main/resources/spring/dubbo-demo-consumer.xml | 33 --
.../main/resources/spring/dubbo-demo-provider.xml | 35 --
.../src/test/java/DemoServiceIT.java | 91 ---
.../case-configuration.yml | 24 -
.../dubbo-serialization-protostuff-test/pom.xml | 159 -----
.../protostuff/EmbeddedZooKeeper.java | 251 --------
.../protostuff/ProtostuffProvider.java | 39 --
.../src/main/resources/log4j.properties | 25 -
.../main/resources/spring/dubbo-demo-consumer.xml | 33 --
.../main/resources/spring/dubbo-demo-provider.xml | 35 --
.../src/test/java/DemoServiceIT.java | 63 --
.../dubbo-serialization-testcase/pom.xml | 49 --
.../test/serialization/testcase/BigPerson.java | 181 ------
.../test/serialization/testcase/DemoService.java | 30 -
.../serialization/testcase/DemoServiceImpl.java | 44 --
.../test/serialization/testcase/FullAddress.java | 202 -------
.../test/serialization/testcase/PersonInfo.java | 191 ------
.../test/serialization/testcase/PersonStatus.java | 22 -
.../dubbo/test/serialization/testcase/Phone.java | 139 -----
.../scenarios-dubbo-serialization/pom.xml | 48 --
test/scripts/clean-damaged-image.sh | 15 -
test/scripts/merge-test-results.sh | 68 ---
test/scripts/prepare-test.sh | 32 -
160 files changed, 900 insertions(+), 9322 deletions(-)
diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml
index 48ec1b87..f0f1570b 100644
--- a/.github/workflows/conformance.yml
+++ b/.github/workflows/conformance.yml
@@ -51,27 +51,7 @@ jobs:
run: |
cd ./dubbo-spi-extensions
./mvnw --batch-mode -U -e --no-transfer-progress install -am -DskipTests=true
- - name: "Build Scenarios"
- run: |
- cd ./dubbo-spi-extensions/test
- ../mvnw --batch-mode -U -e --no-transfer-progress install -am -DskipTests=true
- prepare_test:
- name: "Prepare Test"
- runs-on: ubuntu-latest
- env:
- #'JOB_COUNT' MUST match 'job_id' list of 'testjob'
- JOB_COUNT: 3
- steps:
- - uses: actions/checkout@v4
- - name: Prepare test list
- run: |
- bash ./test/scripts/prepare-test.sh
- - name: Upload test list
- uses: actions/upload-artifact@v4
- with:
- name: test-list
- path: test/jobs
testjob:
needs: [ prepare_test,build-extensions ]
diff --git a/README.md b/README.md
index 6e6eaaca..041a94e6 100644
--- a/README.md
+++ b/README.md
@@ -92,7 +92,7 @@ The available extensions are as follows:
- [dubbo-serialization-jackson](dubbo-serialization-extensions/dubbo-serialization-jackson)
- [dubbo-serialization-kryo](dubbo-serialization-extensions/dubbo-serialization-kryo)
- [dubbo-serialization-msgpack](dubbo-serialization-extensions/dubbo-serialization-msgpack)
- - [dubbo-serialization-native-hession](dubbo-serialization-extensions/dubbo-serialization-native-hession)
+ - [dubbo-serialization-native-hessian](dubbo-serialization-extensions/dubbo-serialization-native-hessian)
- [dubbo-serialization-protobuf](dubbo-serialization-extensions/dubbo-serialization-protobuf)
- [dubbo-serialization-protostuff](dubbo-serialization-extensions/dubbo-serialization-protostuff)
- [dubbo-serialization-test](dubbo-serialization-extensions/dubbo-serialization-test)
diff --git a/README_CN.md b/README_CN.md
index 5ff942c7..20fd4e23 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -92,7 +92,7 @@ dubbo-spi-extensions的目的是提供开放的、社区驱动的、可重用的
- [dubbo-serialization-jackson](dubbo-serialization-extensions/dubbo-serialization-jackson)
- [dubbo-serialization-kryo](dubbo-serialization-extensions/dubbo-serialization-kryo)
- [dubbo-serialization-msgpack](dubbo-serialization-extensions/dubbo-serialization-msgpack)
- - [dubbo-serialization-native-hession](dubbo-serialization-extensions/dubbo-serialization-native-hession)
+ - [dubbo-serialization-native-hessian](dubbo-serialization-extensions/dubbo-serialization-native-hessian)
- [dubbo-serialization-protobuf](dubbo-serialization-extensions/dubbo-serialization-protobuf)
- [dubbo-serialization-protostuff](dubbo-serialization-extensions/dubbo-serialization-protostuff)
- [dubbo-serialization-test](dubbo-serialization-extensions/dubbo-serialization-test)
diff --git a/dubbo-api-docs/README.md b/dubbo-api-docs/README.md
index 0f5c4f7b..edc3782e 100644
--- a/dubbo-api-docs/README.md
+++ b/dubbo-api-docs/README.md
@@ -9,7 +9,7 @@ Adding some annotations can generate a swagger like document without turning a n
## Involving repositorys
* [dubbo-spi-extensions](https://github.com/apache/dubbo-spi-extensions)
- [\branch: 3.2.0\dubbo-api-docs](https://github.com/apache/dubbo-spi-extensions/tree/3.2.0/dubbo-api-docs):
+ [\branch: 3.3.0\dubbo-api-docs](https://github.com/apache/dubbo-spi-extensions/tree/3.3.0/dubbo-api-docs):
Dubbo-Api-Docs related annotation ,annotation parsing
* [dubbo-admin](https://github.com/KeRan213539/dubbo-admin): Dubbo-Api-Docs document display, test function
@@ -25,7 +25,7 @@ Adding some annotations can generate a swagger like document without turning a n
* Of course, Dubbo API Docs consumed a little CPU resources when the project starting and used a little memory
for caching. In the future, it will consider putting the contents of the cache into the metadata center
-### Current Version: 3.2.0
+### Current Version: 3.3.0
```
<dependency>
diff --git a/dubbo-api-docs/README_ch.md b/dubbo-api-docs/README_ch.md
index 4a19809a..b68eabb2 100644
--- a/dubbo-api-docs/README_ch.md
+++ b/dubbo-api-docs/README_ch.md
@@ -9,7 +9,7 @@ dubbo 接口文档、测试工具,根据注解生成文档,并提供测试功能
## 相关项目
* [dubbo-spi-extensions](https://github.com/apache/dubbo-spi-extensions)
- [\分支: 3.2.0\dubbo-api-docs](https://github.com/apache/dubbo-spi-extensions/tree/3.2.0/dubbo-api-docs):
+ [\分支: 3.3.0\dubbo-api-docs](https://github.com/apache/dubbo-spi-extensions/tree/3.3.0/dubbo-api-docs):
Dubbo-Api-Docs 相关注解,解析注解
* [dubbo-admin](https://github.com/KeRan213539/dubbo-admin): Dubbo-Api-Docs 文档展示,测试功能
@@ -22,7 +22,7 @@ dubbo 接口文档、测试工具,根据注解生成文档,并提供测试功能
* 为避免增加生产环境中的资源占用, 建议单独创建一个配制类用于启用Dubbo Api Docs, 并配合 @Profile("dev") 注解使用
* 当然, Dubbo Api Docs 仅在项目启动时多消耗了点CPU资源, 并使用了一点点内存用于缓存, 将来会考虑将缓存中的内容放到元数据中心.
-### 当前版本: 3.2.0
+### 当前版本: 3.3.0
```
<dependency>
diff --git a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml
index 88921cec..56995e9a 100644
--- a/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml
+++ b/dubbo-api-docs/dubbo-api-docs-examples/examples-provider/pom.xml
@@ -101,10 +101,6 @@
<artifactId>curator-recipes</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-monitor-default</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
diff --git a/dubbo-extensions-dependencies-bom/pom.xml b/dubbo-extensions-dependencies-bom/pom.xml
index 0907ddcb..fc937854 100644
--- a/dubbo-extensions-dependencies-bom/pom.xml
+++ b/dubbo-extensions-dependencies-bom/pom.xml
@@ -89,60 +89,61 @@
</issueManagement>
<properties>
- <revision>3.2.1-SNAPSHOT</revision>
- <dubbo.version>3.2.14</dubbo.version>
- <spring.version>5.3.37</spring.version>
+ <revision>3.3.0</revision>
+ <dubbo.version>3.3.0-beta.2</dubbo.version>
+ <spring.version>5.2.9.RELEASE</spring.version>
<spring-boot.version>2.7.18</spring-boot.version>
<!-- Fabric8 for Kubernetes -->
- <fabric8_kubernetes_version>6.13.1</fabric8_kubernetes_version>
- <hessian_version>4.0.66</hessian_version>
- <httpclient_version>4.5.14</httpclient_version>
+ <fabric8_kubernetes_version>6.12.0</fabric8_kubernetes_version>
+ <hessian_version>4.0.51</hessian_version>
+ <httpclient_version>4.5.13</httpclient_version>
<jsonrpc_version>1.2.0</jsonrpc_version>
<portlet_version>2.0</portlet_version>
- <xmemcached_version>1.4.3</xmemcached_version>
+ <xmemcached_version>1.3.6</xmemcached_version>
<thrift_version>0.12.0</thrift_version>
<jedis_version>3.10.0</jedis_version>
- <embedded_redis_version>0.13.0</embedded_redis_version>
- <commons_lang3_version>3.15.0</commons_lang3_version>
+ <embedded_redis_version>0.10.0</embedded_redis_version>
+ <commons_lang3_version>3.14.0</commons_lang3_version>
<jaxb_version>2.2.7</jaxb_version>
<activation_version>1.2.0</activation_version>
<cxf_version>3.1.15</cxf_version>
<avro_version>1.11.3</avro_version>
<fastjson_version>1.2.83</fastjson_version>
- <fst_version>2.57</fst_version>
- <fury_version>0.6.0</fury_version>
- <jackson_version>2.17.2</jackson_version>
- <gson_version>2.11.0</gson_version>
- <kryo_version>5.6.0</kryo_version>
+ <fst_version>2.48-jdk-6</fst_version>
+ <fury_version>0.2.0</fury_version>
+ <apache.fury_version>0.7.0</apache.fury_version>
+ <jackson_version>2.15.3</jackson_version>
+ <gson_version>2.10.1</gson_version>
+ <kryo_version>5.4.0</kryo_version>
<kryo_serializers_version>0.45</kryo_serializers_version>
- <msgpack_version>0.9.8</msgpack_version>
+ <msgpack_version>0.8.22</msgpack_version>
<protostuff_version>1.8.0</protostuff_version>
<mina_version>1.1.7</mina_version>
- <slf4j_version>1.7.36</slf4j_version>
+ <slf4j_version>1.7.25</slf4j_version>
<grizzly_version>2.4.4</grizzly_version>
<jetcd_version>0.7.7</jetcd_version>
- <grpc.version>1.65.1</grpc.version>
+ <grpc.version>1.63.0</grpc.version>
<etcd_launcher_version>0.7.7</etcd_launcher_version>
- <netty4_version>4.1.112.Final</netty4_version>
+ <netty4_version>4.1.66.Final</netty4_version>
<consul_process_version>2.2.1</consul_process_version>
- <consul_version>1.4.5</consul_version>
- <consul_client_version>1.5.3</consul_client_version>
- <test_container_version>1.20.0</test_container_version>
- <seata_version>1.8.0</seata_version>
- <eureka.version>1.10.18</eureka.version>
+ <consul_version>1.4.2</consul_version>
+ <consul_client_version>1.3.7</consul_client_version>
+ <test_container_version>1.19.8</test_container_version>
+ <seata_version>1.5.2</seata_version>
+ <eureka.version>1.9.12</eureka.version>
<sofa_registry_version>5.4.3</sofa_registry_version>
- <logback_version>1.5.6</logback_version>
- <rs_api_version>2.1.1</rs_api_version>
+ <logback_version>1.3.12</logback_version>
+ <rs_api_version>2.0</rs_api_version>
<resteasy_version>3.15.6.Final</resteasy_version>
<codehaus-jackson_version>1.9.13</codehaus-jackson_version>
<swagger_version>1.6.14</swagger_version>
<polaris_adapter_version>0.2.1</polaris_adapter_version>
<maven_flatten_version>1.2.5</maven_flatten_version>
- <byte-buddy.version>1.14.18</byte-buddy.version>
- <commons_net_version>3.11.1</commons_net_version>
+ <byte-buddy.version>1.14.5</byte-buddy.version>
+ <commons_net_version>3.9.0</commons_net_version>
<snakeyaml_version>2.2</snakeyaml_version>
- <protobuf-java_version>3.25.4</protobuf-java_version>
+ <protobuf-java_version>3.25.3</protobuf-java_version>
<bouncycastle-bcprov_version>1.70</bouncycastle-bcprov_version>
<envoy_api_version>0.1.35</envoy_api_version>
<mockito_version>5.11.0</mockito_version>
@@ -321,10 +322,15 @@
<version>${fst_version}</version>
</dependency>
<dependency>
- <groupId>org.apache.fury</groupId>
+ <groupId>org.furyio</groupId>
<artifactId>fury-core</artifactId>
<version>${fury_version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.fury</groupId>
+ <artifactId>fury-core</artifactId>
+ <version>${apache.fury_version}</version>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
diff --git a/dubbo-gateway-extensions/dubbo-gateway-provider/src/main/java/org/apache/dubbo/gateway/provider/ConfigDeployListener.java b/dubbo-gateway-extensions/dubbo-gateway-provider/src/main/java/org/apache/dubbo/gateway/provider/ConfigDeployListener.java
index 788d8c02..589fb0d1 100644
--- a/dubbo-gateway-extensions/dubbo-gateway-provider/src/main/java/org/apache/dubbo/gateway/provider/ConfigDeployListener.java
+++ b/dubbo-gateway-extensions/dubbo-gateway-provider/src/main/java/org/apache/dubbo/gateway/provider/ConfigDeployListener.java
@@ -20,13 +20,13 @@ package org.apache.dubbo.gateway.provider;
import org.apache.dubbo.common.deploy.ApplicationDeployListener;
import org.apache.dubbo.rpc.model.ApplicationModel;
-import static org.apache.dubbo.common.constants.CommonConstants.BYTE_ACCESSOR_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.SystemProperty.SYSTEM_BYTE_ACCESSOR_KEY;
public class ConfigDeployListener implements ApplicationDeployListener {
@Override
public void onInitialize(ApplicationModel scopeModel) {
- System.setProperty(BYTE_ACCESSOR_KEY, "snf");
+ System.setProperty(SYSTEM_BYTE_ACCESSOR_KEY, "snf");
}
@Override
diff --git a/dubbo-registry-extensions/dubbo-registry-polaris/src/main/java/org/apache/dubbo/registry/polaris/PolarisRegistry.java b/dubbo-registry-extensions/dubbo-registry-polaris/src/main/java/org/apache/dubbo/registry/polaris/PolarisRegistry.java
index 8b021e9c..fcab92a2 100644
--- a/dubbo-registry-extensions/dubbo-registry-polaris/src/main/java/org/apache/dubbo/registry/polaris/PolarisRegistry.java
+++ b/dubbo-registry-extensions/dubbo-registry-polaris/src/main/java/org/apache/dubbo/registry/polaris/PolarisRegistry.java
@@ -120,7 +120,7 @@ public class PolarisRegistry extends FailbackRegistry {
}
}
- private boolean shouldRegister(URL url) {
+ protected boolean shouldRegister(URL url) {
return !StringUtils.equals(url.getProtocol(), CommonConstants.CONSUMER);
}
diff --git a/dubbo-rpc-extensions/dubbo-rpc-hessian/pom.xml b/dubbo-rpc-extensions/dubbo-rpc-hessian/pom.xml
index 5e78ad2c..e696e558 100644
--- a/dubbo-rpc-extensions/dubbo-rpc-hessian/pom.xml
+++ b/dubbo-rpc-extensions/dubbo-rpc-hessian/pom.xml
@@ -63,7 +63,7 @@
</dependency>
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-native-hession</artifactId>
+ <artifactId>dubbo-serialization-native-hessian</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
diff --git a/dubbo-serialization-extensions/dubbo-serialization-fury/pom.xml b/dubbo-serialization-extensions/dubbo-serialization-fury/pom.xml
index c2331b81..8c787bee 100644
--- a/dubbo-serialization-extensions/dubbo-serialization-fury/pom.xml
+++ b/dubbo-serialization-extensions/dubbo-serialization-fury/pom.xml
@@ -32,8 +32,6 @@ limitations under the License.
<version>${revision}</version>
<properties>
- <maven.compiler.source>17</maven.compiler.source>
- <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -52,7 +50,6 @@ limitations under the License.
<groupId>org.apache.fury</groupId>
<artifactId>fury-core</artifactId>
</dependency>
-
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-serialization-test</artifactId>
diff --git a/dubbo-serialization-extensions/dubbo-serialization-fury/pom.xml b/dubbo-serialization-extensions/dubbo-serialization-jdk/pom.xml
similarity index 71%
copy from dubbo-serialization-extensions/dubbo-serialization-fury/pom.xml
copy to dubbo-serialization-extensions/dubbo-serialization-jdk/pom.xml
index c2331b81..43525f81 100644
--- a/dubbo-serialization-extensions/dubbo-serialization-fury/pom.xml
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/pom.xml
@@ -15,9 +15,8 @@ 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">
+<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.dubbo.extensions</groupId>
@@ -25,18 +24,17 @@ limitations under the License.
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
-
- <artifactId>dubbo-serialization-fury</artifactId>
+ <artifactId>dubbo-serialization-jdk</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
+ <description>The jdk serialization module of dubbo project</description>
<version>${revision}</version>
<properties>
- <maven.compiler.source>17</maven.compiler.source>
- <maven.compiler.target>17</maven.compiler.target>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
-
<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
@@ -45,19 +43,12 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
+ <artifactId>dubbo-common</artifactId>
<optional>true</optional>
</dependency>
<dependency>
- <groupId>org.apache.fury</groupId>
- <artifactId>fury-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-test</artifactId>
- <version>${revision}</version>
- <scope>test</scope>
+ <groupId>com.alibaba</groupId>
+ <artifactId>hessian-lite</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2Serialization.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedJavaSerialization.java
similarity index 72%
copy from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2Serialization.java
copy to dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedJavaSerialization.java
index ee588768..b87e75c0 100644
--- a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2Serialization.java
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedJavaSerialization.java
@@ -14,8 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.serialize.hessian;
-
+package org.apache.dubbo.common.serialize.java;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.serialize.ObjectInput;
@@ -26,28 +25,34 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import static org.apache.dubbo.common.serialize.Constants.NATIVE_HESSIAN_SERIALIZATION_ID;
+import static org.apache.dubbo.common.serialize.Constants.COMPACTED_JAVA_SERIALIZATION_ID;
-public class Hessian2Serialization implements Serialization {
+/**
+ * Compacted java serialization implementation
+ *
+ * <pre>
+ * e.g. <dubbo:protocol serialization="compactedjava" />
+ * </pre>
+ */
+public class CompactedJavaSerialization implements Serialization {
@Override
public byte getContentTypeId() {
- return NATIVE_HESSIAN_SERIALIZATION_ID;
+ return COMPACTED_JAVA_SERIALIZATION_ID;
}
@Override
public String getContentType() {
- return "x-application/native-hessian";
+ return "x-application/compactedjava";
}
@Override
public ObjectOutput serialize(URL url, OutputStream out) throws IOException {
- return new Hessian2ObjectOutput(out);
+ return new JavaObjectOutput(out, true);
}
@Override
public ObjectInput deserialize(URL url, InputStream is) throws IOException {
- return new Hessian2ObjectInput(is);
+ return new JavaObjectInput(is, true);
}
-
}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java
new file mode 100644
index 00000000..045fec3b
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectInputStream.java
@@ -0,0 +1,63 @@
+/*
+ * 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.dubbo.common.serialize.java;
+
+import org.apache.dubbo.common.utils.ClassUtils;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.io.StreamCorruptedException;
+
+/**
+ * Compacted java object input implementation
+ */
+public class CompactedObjectInputStream extends ObjectInputStream {
+ private ClassLoader mClassLoader;
+
+ public CompactedObjectInputStream(InputStream in) throws IOException {
+ this(in, Thread.currentThread().getContextClassLoader());
+ }
+
+ public CompactedObjectInputStream(InputStream in, ClassLoader cl) throws IOException {
+ super(in);
+ mClassLoader = cl == null ? ClassUtils.getClassLoader() : cl;
+ }
+
+ @Override
+ protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
+ int type = read();
+ if (type < 0) {
+ throw new EOFException();
+ }
+ switch (type) {
+ case 0:
+ return super.readClassDescriptor();
+ case 1:
+ Class<?> clazz = loadClass(readUTF());
+ return ObjectStreamClass.lookup(clazz);
+ default:
+ throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
+ }
+ }
+
+ private Class<?> loadClass(String className) throws ClassNotFoundException {
+ return mClassLoader.loadClass(className);
+ }
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdSerializer.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectOutputStream.java
old mode 100755
new mode 100644
similarity index 56%
copy from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdSerializer.java
copy to dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectOutputStream.java
index 71046702..d9310831
--- a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdSerializer.java
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/CompactedObjectOutputStream.java
@@ -14,30 +14,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.dubbo.serialize.hessian.serializer.java8;
-
-
-import com.caucho.hessian.io.AbstractHessianOutput;
-import com.caucho.hessian.io.AbstractSerializer;
+package org.apache.dubbo.common.serialize.java;
import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.OutputStream;
-public class ZoneIdSerializer extends AbstractSerializer {
-
- private static final ZoneIdSerializer SERIALIZER = new ZoneIdSerializer();
-
- public static ZoneIdSerializer getInstance() {
- return SERIALIZER;
+/**
+ * Compacted java object output implementation
+ */
+public class CompactedObjectOutputStream extends ObjectOutputStream {
+ public CompactedObjectOutputStream(OutputStream out) throws IOException {
+ super(out);
}
@Override
- public void writeObject(Object obj, AbstractHessianOutput out) throws IOException {
- if (obj == null) {
- out.writeNull();
+ protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
+ Class<?> clazz = desc.forClass();
+ if (clazz.isPrimitive() || clazz.isArray()) {
+ write(0);
+ super.writeClassDescriptor(desc);
} else {
- out.writeObject(new ZoneIdHandle(obj));
+ write(1);
+ writeUTF(desc.getName());
}
}
-
}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectInput.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectInput.java
new file mode 100644
index 00000000..bbdd02ff
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectInput.java
@@ -0,0 +1,89 @@
+/*
+ * 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.dubbo.common.serialize.java;
+
+import org.apache.dubbo.common.serialize.nativejava.NativeJavaObjectInput;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.lang.reflect.Type;
+
+/**
+ * Java object input implementation
+ */
+public class JavaObjectInput extends NativeJavaObjectInput {
+ public static final int MAX_BYTE_ARRAY_LENGTH = 8 * 1024 * 1024;
+
+ public JavaObjectInput(InputStream is) throws IOException {
+ super(new ObjectInputStream(is));
+ }
+
+ public JavaObjectInput(InputStream is, boolean compacted) throws IOException {
+ super(compacted ? new CompactedObjectInputStream(is) : new ObjectInputStream(is));
+ }
+
+ @Override
+ public byte[] readBytes() throws IOException {
+ int len = getObjectInputStream().readInt();
+ if (len < 0) {
+ return null;
+ }
+ if (len == 0) {
+ return new byte[0];
+ }
+ if (len > MAX_BYTE_ARRAY_LENGTH) {
+ throw new IOException("Byte array length too large. " + len);
+ }
+
+ byte[] b = new byte[len];
+ getObjectInputStream().readFully(b);
+ return b;
+ }
+
+ @Override
+ public String readUTF() throws IOException {
+ int len = getObjectInputStream().readInt();
+ if (len < 0) {
+ return null;
+ }
+
+ return getObjectInputStream().readUTF();
+ }
+
+ @Override
+ public Object readObject() throws IOException, ClassNotFoundException {
+ byte b = getObjectInputStream().readByte();
+ if (b == 0) {
+ return null;
+ }
+
+ return getObjectInputStream().readObject();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException {
+ return (T) readObject();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException {
+ return (T) readObject();
+ }
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectOutput.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectOutput.java
new file mode 100644
index 00000000..0e78747c
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaObjectOutput.java
@@ -0,0 +1,61 @@
+/*
+ * 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.dubbo.common.serialize.java;
+
+import org.apache.dubbo.common.serialize.nativejava.NativeJavaObjectOutput;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+
+/**
+ * Java object output implementation
+ */
+public class JavaObjectOutput extends NativeJavaObjectOutput {
+ public JavaObjectOutput(OutputStream os) throws IOException {
+ super(new ObjectOutputStream(os));
+ }
+
+ public JavaObjectOutput(OutputStream os, boolean compact) throws IOException {
+ super(compact ? new CompactedObjectOutputStream(os) : new ObjectOutputStream(os));
+ }
+
+ @Override
+ public void writeUTF(String v) throws IOException {
+ if (v == null) {
+ getObjectOutputStream().writeInt(-1);
+ } else {
+ getObjectOutputStream().writeInt(v.length());
+ getObjectOutputStream().writeUTF(v);
+ }
+ }
+
+ @Override
+ public void writeObject(Object obj) throws IOException {
+ if (obj == null) {
+ getObjectOutputStream().writeByte(0);
+ } else {
+ getObjectOutputStream().writeByte(1);
+ getObjectOutputStream().writeObject(obj);
+ }
+ }
+
+ @Override
+ public void flushBuffer() throws IOException {
+ getObjectOutputStream().flush();
+ }
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaSerialization.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaSerialization.java
new file mode 100644
index 00000000..1962ab41
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/java/JavaSerialization.java
@@ -0,0 +1,82 @@
+/*
+ * 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.dubbo.common.serialize.java;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.serialize.ObjectInput;
+import org.apache.dubbo.common.serialize.ObjectOutput;
+import org.apache.dubbo.common.serialize.Serialization;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_UNSAFE_SERIALIZATION;
+import static org.apache.dubbo.common.serialize.Constants.JAVA_SERIALIZATION_ID;
+
+/**
+ * Java serialization implementation
+ *
+ * <pre>
+ * e.g. <dubbo:protocol serialization="java" />
+ * </pre>
+ */
+public class JavaSerialization implements Serialization {
+ private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(JavaSerialization.class);
+ private static final AtomicBoolean warn = new AtomicBoolean(false);
+
+ @Override
+ public byte getContentTypeId() {
+ return JAVA_SERIALIZATION_ID;
+ }
+
+ @Override
+ public String getContentType() {
+ return "x-application/java";
+ }
+
+ @Override
+ public ObjectOutput serialize(URL url, OutputStream out) throws IOException {
+ if (warn.compareAndSet(false, true)) {
+ logger.error(
+ PROTOCOL_UNSAFE_SERIALIZATION,
+ "",
+ "",
+ "Java serialization is unsafe. Dubbo Team do not recommend anyone to use it."
+ + "If you still want to use it, please follow [JEP 290](https://openjdk.java.net/jeps/290)"
+ + "to set serialization filter to prevent deserialization leak.");
+ }
+ return new JavaObjectOutput(out);
+ }
+
+ @Override
+ public ObjectInput deserialize(URL url, InputStream is) throws IOException {
+ if (warn.compareAndSet(false, true)) {
+ logger.error(
+ PROTOCOL_UNSAFE_SERIALIZATION,
+ "",
+ "",
+ "Java serialization is unsafe. Dubbo Team do not recommend anyone to use it."
+ + "If you still want to use it, please follow [JEP 290](https://openjdk.java.net/jeps/290)"
+ + "to set serialization filter to prevent deserialization leak.");
+ }
+ return new JavaObjectInput(is);
+ }
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectInput.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectInput.java
similarity index 52%
copy from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectInput.java
copy to dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectInput.java
index 5f7430ac..74431832 100644
--- a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectInput.java
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectInput.java
@@ -14,87 +14,104 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.serialize.hessian;
+package org.apache.dubbo.common.serialize.nativejava;
import org.apache.dubbo.common.serialize.ObjectInput;
-import org.apache.dubbo.serialize.hessian.dubbo.Hessian2FactoryInitializer;
-
-import com.caucho.hessian.io.Hessian2Input;
+import org.apache.dubbo.common.utils.Assert;
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInputStream;
import java.lang.reflect.Type;
/**
- * Hessian2 Object input.
+ * Native java object input implementation
*/
-public class Hessian2ObjectInput implements ObjectInput {
- private final Hessian2Input input;
+public class NativeJavaObjectInput implements ObjectInput {
+
+ private final ObjectInputStream inputStream;
- public Hessian2ObjectInput(InputStream is) {
- input = new Hessian2Input(is);
- input.setSerializerFactory(Hessian2FactoryInitializer.getInstance().getSerializerFactory());
+ public NativeJavaObjectInput(InputStream is) throws IOException {
+ this(new ObjectInputStream(is));
}
- @Override
- public boolean readBool() throws IOException {
- return input.readBoolean();
+ protected NativeJavaObjectInput(ObjectInputStream is) {
+ Assert.notNull(is, "input == null");
+ inputStream = is;
+ }
+
+ protected ObjectInputStream getObjectInputStream() {
+ return inputStream;
}
@Override
- public byte readByte() throws IOException {
- return (byte) input.readInt();
+ public Object readObject() throws IOException, ClassNotFoundException {
+ return inputStream.readObject();
}
@Override
- public short readShort() throws IOException {
- return (short) input.readInt();
+ @SuppressWarnings("unchecked")
+ public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException {
+ return (T) readObject();
}
@Override
- public int readInt() throws IOException {
- return input.readInt();
+ @SuppressWarnings("unchecked")
+ public <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException {
+ return (T) readObject();
}
@Override
- public long readLong() throws IOException {
- return input.readLong();
+ public boolean readBool() throws IOException {
+ return inputStream.readBoolean();
}
@Override
- public float readFloat() throws IOException {
- return (float) input.readDouble();
+ public byte readByte() throws IOException {
+ return inputStream.readByte();
}
@Override
- public double readDouble() throws IOException {
- return input.readDouble();
+ public short readShort() throws IOException {
+ return inputStream.readShort();
}
@Override
- public byte[] readBytes() throws IOException {
- return input.readBytes();
+ public int readInt() throws IOException {
+ return inputStream.readInt();
}
@Override
- public String readUTF() throws IOException {
- return input.readString();
+ public long readLong() throws IOException {
+ return inputStream.readLong();
}
@Override
- public Object readObject() throws IOException {
- return input.readObject();
+ public float readFloat() throws IOException {
+ return inputStream.readFloat();
}
@Override
- @SuppressWarnings("unchecked")
- public <T> T readObject(Class<T> cls) throws IOException {
- return (T) input.readObject(cls);
+ public double readDouble() throws IOException {
+ return inputStream.readDouble();
}
@Override
- public <T> T readObject(Class<T> cls, Type type) throws IOException {
- return readObject(cls);
+ public String readUTF() throws IOException {
+ return inputStream.readUTF();
}
+ @Override
+ public byte[] readBytes() throws IOException {
+ int len = inputStream.readInt();
+ if (len < 0) {
+ return null;
+ } else if (len == 0) {
+ return new byte[] {};
+ } else {
+ byte[] result = new byte[len];
+ inputStream.readFully(result);
+ return result;
+ }
+ }
}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectOutput.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectOutput.java
similarity index 55%
copy from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectOutput.java
copy to dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectOutput.java
index 2bc2d014..a3274094 100644
--- a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectOutput.java
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaObjectOutput.java
@@ -14,84 +14,101 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.serialize.hessian;
+package org.apache.dubbo.common.serialize.nativejava;
import org.apache.dubbo.common.serialize.ObjectOutput;
-import org.apache.dubbo.serialize.hessian.dubbo.Hessian2FactoryInitializer;
-
-import com.caucho.hessian.io.Hessian2Output;
+import org.apache.dubbo.common.utils.Assert;
import java.io.IOException;
+import java.io.ObjectOutputStream;
import java.io.OutputStream;
/**
- * Hessian2 Object output.
+ * Native java object output implementation
*/
-public class Hessian2ObjectOutput implements ObjectOutput {
- private final Hessian2Output output;
+public class NativeJavaObjectOutput implements ObjectOutput {
+
+ private final ObjectOutputStream outputStream;
+
+ public NativeJavaObjectOutput(OutputStream os) throws IOException {
+ this(new ObjectOutputStream(os));
+ }
+
+ protected NativeJavaObjectOutput(ObjectOutputStream out) {
+ Assert.notNull(out, "output == null");
+ this.outputStream = out;
+ }
+
+ protected ObjectOutputStream getObjectOutputStream() {
+ return outputStream;
+ }
- public Hessian2ObjectOutput(OutputStream os) {
- output = new Hessian2Output(os);
- output.setSerializerFactory(Hessian2FactoryInitializer.getInstance().getSerializerFactory());
+ @Override
+ public void writeObject(Object obj) throws IOException {
+ outputStream.writeObject(obj);
}
@Override
public void writeBool(boolean v) throws IOException {
- output.writeBoolean(v);
+ outputStream.writeBoolean(v);
}
@Override
public void writeByte(byte v) throws IOException {
- output.writeInt(v);
+ outputStream.writeByte(v);
}
@Override
public void writeShort(short v) throws IOException {
- output.writeInt(v);
+ outputStream.writeShort(v);
}
@Override
public void writeInt(int v) throws IOException {
- output.writeInt(v);
+ outputStream.writeInt(v);
}
@Override
public void writeLong(long v) throws IOException {
- output.writeLong(v);
+ outputStream.writeLong(v);
}
@Override
public void writeFloat(float v) throws IOException {
- output.writeDouble(v);
+ outputStream.writeFloat(v);
}
@Override
public void writeDouble(double v) throws IOException {
- output.writeDouble(v);
- }
-
- @Override
- public void writeBytes(byte[] b) throws IOException {
- output.writeBytes(b);
+ outputStream.writeDouble(v);
}
@Override
- public void writeBytes(byte[] b, int off, int len) throws IOException {
- output.writeBytes(b, off, len);
+ public void writeUTF(String v) throws IOException {
+ outputStream.writeUTF(v);
}
@Override
- public void writeUTF(String v) throws IOException {
- output.writeString(v);
+ public void writeBytes(byte[] v) throws IOException {
+ if (v == null) {
+ outputStream.writeInt(-1);
+ } else {
+ writeBytes(v, 0, v.length);
+ }
}
@Override
- public void writeObject(Object obj) throws IOException {
- output.writeObject(obj);
+ public void writeBytes(byte[] v, int off, int len) throws IOException {
+ if (v == null) {
+ outputStream.writeInt(-1);
+ } else {
+ outputStream.writeInt(len);
+ outputStream.write(v, off, len);
+ }
}
@Override
public void flushBuffer() throws IOException {
- output.flushBuffer();
+ outputStream.flush();
}
}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaSerialization.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaSerialization.java
new file mode 100644
index 00000000..ea37e998
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/java/org/apache/dubbo/common/serialize/nativejava/NativeJavaSerialization.java
@@ -0,0 +1,83 @@
+/*
+ * 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.dubbo.common.serialize.nativejava;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.serialize.ObjectInput;
+import org.apache.dubbo.common.serialize.ObjectOutput;
+import org.apache.dubbo.common.serialize.Serialization;
+import org.apache.dubbo.common.serialize.java.JavaSerialization;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_UNSAFE_SERIALIZATION;
+import static org.apache.dubbo.common.serialize.Constants.NATIVE_JAVA_SERIALIZATION_ID;
+
+/**
+ * Native java serialization implementation
+ *
+ * <pre>
+ * e.g. <dubbo:protocol serialization="nativejava" />
+ * </pre>
+ */
+public class NativeJavaSerialization implements Serialization {
+ private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(JavaSerialization.class);
+ private static final AtomicBoolean warn = new AtomicBoolean(false);
+
+ @Override
+ public byte getContentTypeId() {
+ return NATIVE_JAVA_SERIALIZATION_ID;
+ }
+
+ @Override
+ public String getContentType() {
+ return "x-application/nativejava";
+ }
+
+ @Override
+ public ObjectOutput serialize(URL url, OutputStream output) throws IOException {
+ if (warn.compareAndSet(false, true)) {
+ logger.error(
+ PROTOCOL_UNSAFE_SERIALIZATION,
+ "",
+ "",
+ "Java serialization is unsafe. Dubbo Team do not recommend anyone to use it."
+ + "If you still want to use it, please follow [JEP 290](https://openjdk.java.net/jeps/290)"
+ + "to set serialization filter to prevent deserialization leak.");
+ }
+ return new NativeJavaObjectOutput(output);
+ }
+
+ @Override
+ public ObjectInput deserialize(URL url, InputStream input) throws IOException {
+ if (warn.compareAndSet(false, true)) {
+ logger.error(
+ PROTOCOL_UNSAFE_SERIALIZATION,
+ "",
+ "",
+ "Java serialization is unsafe. Dubbo Team do not recommend anyone to use it."
+ + "If you still want to use it, please follow [JEP 290](https://openjdk.java.net/jeps/290)"
+ + "to set serialization filter to prevent deserialization leak.");
+ }
+ return new NativeJavaObjectInput(input);
+ }
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization
new file mode 100644
index 00000000..bc1e4ef0
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization
@@ -0,0 +1,3 @@
+java=org.apache.dubbo.common.serialize.java.JavaSerialization
+compactedjava=org.apache.dubbo.common.serialize.java.CompactedJavaSerialization
+nativejava=org.apache.dubbo.common.serialize.nativejava.NativeJavaSerialization
\ No newline at end of file
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/Image.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/Image.java
new file mode 100644
index 00000000..b6a1b545
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/Image.java
@@ -0,0 +1,120 @@
+/*
+ * 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.dubbo.common.serialize.jdk;
+
+
+public class Image implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+ public String uri;
+ public String title; // Can be null
+ public int width;
+ public int height;
+ public Size size;
+
+ public Image() {
+ }
+
+ public Image(String uri, String title, int width, int height, Size size) {
+ this.height = height;
+ this.title = title;
+ this.uri = uri;
+ this.width = width;
+ this.size = size;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Image image = (Image) o;
+
+ if (height != image.height) return false;
+ if (width != image.width) return false;
+ if (size != image.size) return false;
+ if (title != null ? !title.equals(image.title) : image.title != null) return false;
+ if (uri != null ? !uri.equals(image.uri) : image.uri != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = uri != null ? uri.hashCode() : 0;
+ result = 31 * result + (title != null ? title.hashCode() : 0);
+ result = 31 * result + width;
+ result = 31 * result + height;
+ result = 31 * result + (size != null ? size.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[Image ");
+ sb.append("uri=").append(uri);
+ sb.append(", title=").append(title);
+ sb.append(", width=").append(width);
+ sb.append(", height=").append(height);
+ sb.append(", size=").append(size);
+ sb.append("]");
+ return sb.toString();
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public Size getSize() {
+ return size;
+ }
+
+ public void setSize(Size size) {
+ this.size = size;
+ }
+
+ public enum Size {
+ SMALL, LARGE
+ }
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkObjectOutputTest.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkObjectOutputTest.java
new file mode 100644
index 00000000..4043c072
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkObjectOutputTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.dubbo.common.serialize.jdk;
+
+import org.apache.dubbo.common.serialize.java.JavaObjectInput;
+import org.apache.dubbo.common.serialize.java.JavaObjectOutput;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * {@link JavaObjectOutput} Unit Test
+ */
+public class JdkObjectOutputTest {
+
+ private JavaObjectOutput javaObjectOutput;
+ private JavaObjectInput jdkObjectInput;
+ private ByteArrayOutputStream byteArrayOutputStream;
+ private ByteArrayInputStream byteArrayInputStream;
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ this.byteArrayOutputStream = new ByteArrayOutputStream();
+ this.javaObjectOutput = new JavaObjectOutput(byteArrayOutputStream);
+ }
+
+ @Test
+ public void testWriteBool() throws IOException {
+ this.javaObjectOutput.writeBool(true);
+ this.flushToInput();
+
+ assertThat(jdkObjectInput.readBool(), is(true));
+ }
+
+ @Test
+ public void testWriteShort() throws IOException {
+ this.javaObjectOutput.writeShort((short) 2);
+ this.flushToInput();
+
+ assertThat(jdkObjectInput.readShort(), is((short) 2));
+ }
+
+ @Test
+ public void testWriteInt() throws IOException {
+ this.javaObjectOutput.writeInt(1);
+ this.flushToInput();
+
+ assertThat(jdkObjectInput.readInt(), is(1));
+ }
+
+ @Test
+ public void testWriteLong() throws IOException {
+ this.javaObjectOutput.writeLong(1000L);
+ this.flushToInput();
+
+ assertThat(jdkObjectInput.readLong(), is(1000L));
+ }
+
+ @Test
+ public void testWriteUTF() throws IOException {
+ this.javaObjectOutput.writeUTF("Pace Hasîtî 和平 Мир");
+ this.flushToInput();
+
+ assertThat(jdkObjectInput.readUTF(), is("Pace Hasîtî 和平 Мир"));
+ }
+
+
+ @Test
+ public void testWriteFloat() throws IOException {
+ this.javaObjectOutput.writeFloat(1.88f);
+ this.flushToInput();
+
+ assertThat(this.jdkObjectInput.readFloat(), is(1.88f));
+ }
+
+ @Test
+ public void testWriteDouble() throws IOException {
+ this.javaObjectOutput.writeDouble(1.66d);
+ this.flushToInput();
+
+ assertThat(this.jdkObjectInput.readDouble(), is(1.66d));
+ }
+
+ @Test
+ public void testWriteBytes() throws IOException {
+ this.javaObjectOutput.writeBytes("hello".getBytes());
+ this.flushToInput();
+
+ assertThat(this.jdkObjectInput.readBytes(), is("hello".getBytes()));
+ }
+
+ @Test
+ public void testWriteBytesWithSubLength() throws IOException {
+ this.javaObjectOutput.writeBytes("hello".getBytes(), 2, 2);
+ this.flushToInput();
+
+ assertThat(this.jdkObjectInput.readBytes(), is("ll".getBytes()));
+ }
+
+ @Test
+ public void testWriteByte() throws IOException {
+ this.javaObjectOutput.writeByte((byte) 123);
+ this.flushToInput();
+
+ assertThat(this.jdkObjectInput.readByte(), is((byte) 123));
+ }
+
+ @Test
+ public void testWriteObject() throws IOException, ClassNotFoundException {
+ Image image = new Image("http://dubbo.apache.org/img/dubbo_white.png", "logo", 300, 480, Image.Size.SMALL);
+ this.javaObjectOutput.writeObject(image);
+ this.flushToInput();
+
+ Image readObjectForImage = jdkObjectInput.readObject(Image.class);
+ assertThat(readObjectForImage, not(nullValue()));
+ assertThat(readObjectForImage, is(image));
+ }
+
+ private void flushToInput() throws IOException {
+ this.javaObjectOutput.flushBuffer();
+ this.byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+ this.jdkObjectInput = new JavaObjectInput(byteArrayInputStream);
+ }
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkSerializationTest.java b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkSerializationTest.java
new file mode 100644
index 00000000..aa0ed679
--- /dev/null
+++ b/dubbo-serialization-extensions/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkSerializationTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.dubbo.common.serialize.jdk;
+
+import org.apache.dubbo.common.serialize.ObjectOutput;
+import org.apache.dubbo.common.serialize.java.JavaObjectOutput;
+import org.apache.dubbo.common.serialize.java.JavaSerialization;
+
+import org.hamcrest.MatcherAssert;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.mockito.Mockito.mock;
+
+/**
+ * {@link JavaSerialization} Unit Test
+ */
+public class JdkSerializationTest {
+
+ private JavaSerialization JavaSerialization;
+
+ @BeforeEach
+ public void setUp() {
+ this.JavaSerialization = new JavaSerialization();
+ }
+
+ @Test
+ public void testContentTypeId() {
+ MatcherAssert.assertThat(JavaSerialization.getContentTypeId(), is((byte) 3));
+ }
+
+ @Test
+ public void testContentType() {
+ MatcherAssert.assertThat(JavaSerialization.getContentType(), is("x-application/java"));
+ }
+
+ @Test
+ public void testObjectOutput() throws IOException {
+ ObjectOutput objectOutput = JavaSerialization.serialize(null, mock(OutputStream.class));
+ assertThat(objectOutput, Matchers.instanceOf(JavaObjectOutput.class));
+ }
+
+}
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/pom.xml b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/pom.xml
similarity index 96%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/pom.xml
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/pom.xml
index a13e3ed2..3b28b2ae 100644
--- a/dubbo-serialization-extensions/dubbo-serialization-native-hession/pom.xml
+++ b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/pom.xml
@@ -24,7 +24,7 @@ limitations under the License.
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>dubbo-serialization-native-hession</artifactId>
+ <artifactId>dubbo-serialization-native-hessian</artifactId>
<version>${revision}</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectInput.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectInput.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectInput.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectInput.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectOutput.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectOutput.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectOutput.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2ObjectOutput.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2Serialization.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2Serialization.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2Serialization.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2Serialization.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2SerializerFactory.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2SerializerFactory.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2SerializerFactory.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/Hessian2SerializerFactory.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/AbstractHessian2FactoryInitializer.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/AbstractHessian2FactoryInitializer.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/AbstractHessian2FactoryInitializer.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/AbstractHessian2FactoryInitializer.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/DefaultHessian2FactoryInitializer.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/DefaultHessian2FactoryInitializer.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/DefaultHessian2FactoryInitializer.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/DefaultHessian2FactoryInitializer.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/Hessian2FactoryInitializer.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/Hessian2FactoryInitializer.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/Hessian2FactoryInitializer.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/Hessian2FactoryInitializer.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/WhitelistHessian2FactoryInitializer.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/WhitelistHessian2FactoryInitializer.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/WhitelistHessian2FactoryInitializer.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/dubbo/WhitelistHessian2FactoryInitializer.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/DurationHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/DurationHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/DurationHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/DurationHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/InstantHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/InstantHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/InstantHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/InstantHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/Java8TimeSerializer.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/Java8TimeSerializer.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/Java8TimeSerializer.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/Java8TimeSerializer.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateTimeHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateTimeHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateTimeHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalDateTimeHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalTimeHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalTimeHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalTimeHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/LocalTimeHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/MonthDayHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/MonthDayHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/MonthDayHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/MonthDayHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetDateTimeHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetDateTimeHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetDateTimeHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetDateTimeHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetTimeHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetTimeHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetTimeHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/OffsetTimeHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/PeriodHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/PeriodHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/PeriodHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/PeriodHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearMonthHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearMonthHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearMonthHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/YearMonthHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdSerializer.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdSerializer.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdSerializer.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneIdSerializer.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneOffsetHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneOffsetHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneOffsetHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZoneOffsetHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZonedDateTimeHandle.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZonedDateTimeHandle.java
old mode 100755
new mode 100644
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZonedDateTimeHandle.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/java/org/apache/dubbo/serialize/hessian/serializer/java8/ZonedDateTimeHandle.java
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.serialize.hessian.dubbo.Hessian2FactoryInitializer b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.serialize.hessian.dubbo.Hessian2FactoryInitializer
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.serialize.hessian.dubbo.Hessian2FactoryInitializer
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.serialize.hessian.dubbo.Hessian2FactoryInitializer
diff --git a/dubbo-serialization-extensions/dubbo-serialization-native-hession/src/test/java/org/apache/dubbo/serialize/hessian/Java8TimeSerializerTest.java b/dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/test/java/org/apache/dubbo/serialize/hessian/Java8TimeSerializerTest.java
similarity index 100%
rename from dubbo-serialization-extensions/dubbo-serialization-native-hession/src/test/java/org/apache/dubbo/serialize/hessian/Java8TimeSerializerTest.java
rename to dubbo-serialization-extensions/dubbo-serialization-native-hessian/src/test/java/org/apache/dubbo/serialize/hessian/Java8TimeSerializerTest.java
diff --git a/dubbo-serialization-extensions/pom.xml b/dubbo-serialization-extensions/pom.xml
index 8a607d36..cec14402 100644
--- a/dubbo-serialization-extensions/pom.xml
+++ b/dubbo-serialization-extensions/pom.xml
@@ -42,8 +42,9 @@
<module>dubbo-serialization-fury</module>
<module>dubbo-serialization-avro</module>
<module>dubbo-serialization-msgpack</module>
- <module>dubbo-serialization-native-hession</module>
+ <module>dubbo-serialization-native-hessian</module>
<module>dubbo-serialization-jackson</module>
+ <module>dubbo-serialization-jdk</module>
<module>dubbo-serialization-test</module>
<module>dubbo-serialization-common</module>
</modules>
diff --git a/pom.xml b/pom.xml
index abe8b146..a8a4e43e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,7 +105,8 @@
</modules>
<properties>
- <revision>3.2.1-SNAPSHOT</revision>
+ <revision>3.3.0</revision>
+ <dubbo.version>3.3.0-beta.2</dubbo.version>
<!-- Test libs -->
<junit_jupiter_version>5.10.3</junit_jupiter_version>
<junit_platform_commons>1.10.3</junit_platform_commons>
diff --git a/test/build-test-image.sh b/test/build-test-image.sh
deleted file mode 100755
index 9e967253..00000000
--- a/test/build-test-image.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-# Use mirror:
-# DEBIAN_MIRROR=http://mirrors.aliyun.com ./build-test-image.sh
-
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-$DIR/dubbo-test-runner/build.sh
\ No newline at end of file
diff --git a/test/dubbo-scenario-builder/pom.xml b/test/dubbo-scenario-builder/pom.xml
deleted file mode 100644
index 11ef0616..00000000
--- a/test/dubbo-scenario-builder/pom.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<!--
- 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>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-extensions-test</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>dubbo-scenario-builder</artifactId>
-
- <properties>
- <snakeyaml.version>2.0</snakeyaml.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>3.0.0</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- <version>2.3.28</version>
- </dependency>
-
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>${snakeyaml.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.11</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>1.7.25</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.3.12</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>3.3.0</version>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <archive>
- <manifest>
- <mainClass>org.apache.dubbo.scenario.builder.ScenarioBuilderMain</mainClass>
- </manifest>
- </archive>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id> <!-- this is used for inheritance merges -->
- <phase>package</phase> <!-- bind to the packaging phase -->
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/AbstractRunningGenerator.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/AbstractRunningGenerator.java
deleted file mode 100644
index 07792aa5..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/AbstractRunningGenerator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-import org.apache.dubbo.scenario.builder.exception.GenerateFailedException;
-
-import freemarker.template.Configuration;
-import freemarker.template.TemplateExceptionHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.lang.invoke.MethodHandles;
-import java.util.Map;
-
-public abstract class AbstractRunningGenerator implements ScenarioRunningScriptGenerator {
- private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- protected final Configuration cfg;
-
- protected AbstractRunningGenerator() {
- cfg = new Configuration(Configuration.VERSION_2_3_28);
- try {
- cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/");
- cfg.setDefaultEncoding("UTF-8");
- cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
- cfg.setLogTemplateExceptions(false);
- cfg.setWrapUncheckedExceptions(true);
- cfg.setNumberFormat("computer");
- } catch (Exception e) {
- // never to do this
- }
- }
-
- @Override
- public final void generate(IConfiguration configuration) throws GenerateFailedException {
- generateAdditionFiles(configuration);
-
- final Map<String, Object> root = configuration.toMap();
-
- String scriptPath = configuration.outputDir() + File.separator + "scenario.sh";
- try (FileWriter writer = new FileWriter(new File(scriptPath))) {
- cfg.getTemplate("scenario.sh")
- .process(root, writer);
- } catch (Exception e) {
- LOGGER.error("Failed to write scenario.sh", e);
- }
- }
-
- public abstract void generateAdditionFiles(IConfiguration configuration) throws GenerateFailedException;
-
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java
deleted file mode 100644
index 1ad5e38e..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-import org.apache.dubbo.scenario.builder.exception.ConfigureFileNotFoundException;
-import org.apache.dubbo.scenario.builder.vo.CaseConfiguration;
-import org.apache.dubbo.scenario.builder.vo.DockerService;
-import org.apache.dubbo.scenario.builder.vo.ServiceComponent;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class ConfigurationImpl implements IConfiguration {
- public static final String SAMPLE_TEST_IMAGE = "dubbo/sample-test";
- public static final String DUBBO_APP_DIR = "/usr/local/dubbo/app";
- public static final String DUBBO_LOG_DIR = "/usr/local/dubbo/logs";
-
- //ENV
- public static final String ENV_SERVICE_NAME = "SERVICE_NAME";
- public static final String ENV_SERVICE_TYPE = "SERVICE_TYPE";
- public static final String ENV_APP_MAIN_CLASS = "APP_MAIN_CLASS";
- public static final String ENV_WAIT_PORTS_BEFORE_RUN = "WAIT_PORTS_BEFORE_RUN";
- public static final String ENV_CHECK_PORTS = "CHECK_PORTS";
- public static final String ENV_CHECK_LOG = "CHECK_LOG";
- public static final String ENV_WAIT_TIMEOUT = "WAIT_TIMEOUT";
- public static final String ENV_TEST_PATTERNS = "TEST_PATTERNS";
- public static final String ENV_JAVA_OPTS = "JAVA_OPTS";
- public static final String ENV_DEBUG_OPTS = "DEBUG_OPTS";
- public static final String ENV_SCENARIO_HOME = "SCENARIO_HOME";
- public static final String ENV_RUN_DELAY = "RUN_DELAY";
-
- //PROPS
- public static final String PROP_BASEDIR = "_basedir";
- public static final String PROP_SCENARIO_HOME = "_scenario_home";
- public static final String PROP_SCENARIO_NAME = "_scenario_name";
-
- private static final Logger logger = LoggerFactory.getLogger(ConfigurationImpl.class);
- private final CaseConfiguration configuration;
- private boolean isJdk9OrLater;
- private String scenarioHome;
- private String configBasedir;
- private String scenarioName;
- private final String scenarioLogDir;
- private int scenarioTimeout = 120;
- private int javaDebugPort = 20660;
- private int debugTimeout = 36000;
- private Set<Pattern> debugPatterns = new HashSet<>();
- private Set<String> debugServices = new HashSet<>();
- private Set<String> healthcheckServices = new HashSet<>();
- private String testImageVersion;
-
- public ConfigurationImpl() throws IOException, ConfigureFileNotFoundException {
- String configureFile = System.getProperty("configure.file");
- if (StringUtils.isBlank(configureFile)) {
- throw new ConfigureFileNotFoundException();
- }
- this.configBasedir = new File(configureFile).getParentFile().getCanonicalPath();
- this.configBasedir = this.configBasedir.replace(File.separator, "/");
-
- //set default scenarioHome dir to ${configBasedir}/target
- this.scenarioHome = System.getProperty("scenario.home");
- if (StringUtils.isBlank(scenarioHome)) {
- scenarioHome = configBasedir + "/target";
- }
- scenarioLogDir = new File(scenarioHome, "logs").getCanonicalPath();
-
- //set default scenarioName
- scenarioName = System.getProperty("scenario.name");
- if (StringUtils.isBlank(scenarioName)) {
- scenarioName = new File(configBasedir).getName();
- }
-
- testImageVersion = System.getProperty("test.image.version", "8");
- String verstr = StringUtils.substringBefore(testImageVersion, ".");
- int majorVersion = Integer.parseInt(verstr);
- isJdk9OrLater = (majorVersion > 8);
-
- String debugService = System.getProperty("debug.service");
- if (StringUtils.isNotBlank(debugService)) {
- String[] strs = debugService.split(",");
- for (String str : strs) {
- str = str.trim();
- if (StringUtils.isNotBlank(str)) {
- String regex = "\\Q" + str.replace("*", "\\E.*?\\Q") + "\\E";
- debugPatterns.add(Pattern.compile(regex));
- }
- }
- }
-
- this.configuration = loadCaseConfiguration(configureFile);
-
- //set scenario timeout
- if (this.configuration.getTimeout() > 0) {
- scenarioTimeout = this.configuration.getTimeout();
- }
- String timeout = System.getProperty("timeout");
- if (StringUtils.isNotBlank(timeout)) {
- scenarioTimeout = Integer.parseInt(timeout);
- }
- if (isDebug()) {
- scenarioTimeout = debugTimeout;
- }
-
- logger.info("scenarioName:{}, timeout: {}, testImageVersion: {}, debugServices:{}, config: {}",
- scenarioName, scenarioTimeout, testImageVersion, debugServices, configuration);
-
- if (StringUtils.isNotBlank(configuration.getIgnoreFor())) {
- logger.warn("{} Ignore testing for: {}", Constants.ERROR_MSG_FLAG, configuration.getIgnoreFor());
- System.exit(Constants.EXIT_IGNORED);
- }
-
- }
-
- private boolean isDebugService(String serviceName) {
- for (Pattern pattern : debugPatterns) {
- if (pattern.matcher(serviceName).matches()) {
- debugServices.add(serviceName);
- return true;
- }
- }
- return false;
- }
-
- private boolean isDebug() {
- return debugPatterns != null && debugPatterns.size() > 0;
- }
-
- private CaseConfiguration loadCaseConfiguration(String configureFile) throws IOException {
- // read 'props'
- String configYaml = FileUtil.readFully(configureFile);
- CaseConfiguration tmpConfiguration = parseConfiguration(configYaml);
- Map<String, String> props = tmpConfiguration.getProps();
- if (props == null) {
- props = new HashMap<>();
- }
- configProps(props);
-
- // process 'from', load parent config
- CaseConfiguration parentConfiguration = null;
- if (StringUtils.isNotBlank(tmpConfiguration.getFrom())) {
- String parentConfigYaml = loadParentConfigYaml(tmpConfiguration);
- CaseConfiguration tmpParentConfiguration = parseConfiguration(parentConfigYaml);
-
- //merge props, overwrite parent props
- if (tmpParentConfiguration.getProps() != null) {
- Map<String, String> newProps = new HashMap<>(tmpParentConfiguration.getProps());
- newProps.putAll(props);
- props = newProps;
- }
-
- // replace variables '${...}'
- String newParentConfigYaml = replaceHolders(parentConfigYaml, props);
- parentConfiguration = parseConfiguration(newParentConfigYaml);
- }
-
- // replace variables '${...}'
- String newConfigYaml = replaceHolders(configYaml, props);
- CaseConfiguration caseConfiguration = parseConfiguration(newConfigYaml);
-
- //merge globalSystemProps, overwrite parent
- if (parentConfiguration != null) {
- List<String> systemProps = mergeSystemProps(parentConfiguration.getSystemProps(), caseConfiguration.getSystemProps());
- caseConfiguration.setSystemProps(systemProps);
- }
-
- //merge services
- if (parentConfiguration != null && parentConfiguration.getServices() != null) {
- Map<String, ServiceComponent> newServices = new LinkedHashMap<>(parentConfiguration.getServices());
- if (caseConfiguration.getServices() != null) {
- newServices.putAll(caseConfiguration.getServices());
- }
- caseConfiguration.setServices(newServices);
- }
-
- fillupServices(caseConfiguration);
- return caseConfiguration;
- }
-
- private void configProps(Map<String, String> props) {
- props.put(PROP_BASEDIR, configBasedir);
- props.put(PROP_SCENARIO_HOME, scenarioHome);
- props.put(PROP_SCENARIO_NAME, scenarioName);
- }
-
- private List<String> mergeSystemProps(List<String> parentSystemProps, List<String> childSystemProps) {
- List<String> newSystemProps = new ArrayList<>(parentSystemProps != null ? parentSystemProps : Collections.emptyList());
- if (childSystemProps != null) {
- childSystemProps.forEach(entry -> {
- String[] strs = entry.split("=");
- addOrReplaceKVEntry(newSystemProps, strs[0].trim(), strs.length > 1 ? strs[1].trim() : "");
- });
- }
- return newSystemProps;
- }
-
- private String loadParentConfigYaml(CaseConfiguration caseConfiguration) throws IOException {
- try {
- String file = "configs/" + caseConfiguration.getFrom();
- InputStream inputStream = CaseConfiguration.class.getClassLoader().getResourceAsStream(file);
- return FileUtil.readFully(inputStream);
- } catch (Exception e) {
- logger.error("load parent config failed: " + caseConfiguration.getFrom(), e);
- throw new IOException("load parent config failed: " + caseConfiguration.getFrom(), e);
- }
- }
-
- private CaseConfiguration parseConfiguration(String configYaml) {
- return new Yaml().loadAs(configYaml, CaseConfiguration.class);
- }
-
- private void fillupServices(CaseConfiguration caseConfiguration) throws IOException {
- List<String> caseSystemProps = caseConfiguration.getSystemProps();
- for (Map.Entry<String, ServiceComponent> entry : caseConfiguration.getServices().entrySet()) {
- String serviceName = entry.getKey();
- ServiceComponent service = entry.getValue();
- String type = service.getType();
- if (isAppOrTestService(type)) {
- service.setImage(SAMPLE_TEST_IMAGE + ":" + testImageVersion);
- service.setBasedir(toAbsolutePath(service.getBasedir()));
- if (service.getVolumes() == null) {
- service.setVolumes(new ArrayList<>());
- }
- //mount ${project.basedir}/target : DUBBO_APP_DIR
- String targetPath = new File(service.getBasedir(), "target").getCanonicalPath();
- service.getVolumes().add(targetPath + ":" + DUBBO_APP_DIR);
-
- //mount ${scenario_home}/logs : DUBBO_LOG_DIR
- service.getVolumes().add(scenarioLogDir + ":" + DUBBO_LOG_DIR);
-
- if (service.getEnvironment() == null) {
- service.setEnvironment(new ArrayList<>());
- }
- // set service name
- setEnv(service, ENV_SERVICE_NAME, serviceName);
-
- //set wait ports
- if (isNotEmpty(service.getWaitPortsBeforeRun())) {
- String str = convertAddrPortsToString(service.getWaitPortsBeforeRun());
- setEnv(service, ENV_WAIT_PORTS_BEFORE_RUN, str);
- }
-
- //set run delay
- if (service.getRunDelay() > 0) {
- setEnv(service, ENV_RUN_DELAY, service.getRunDelay() + "");
- }
-
- //set check timeout
- if (isDebug()) {
- service.setWaitTimeout(debugTimeout);
-
- if (isDebugService(serviceName)) {
- //set java remote debug opts
- //-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
- int debugPort = nextDebugPort();
- String debugOpts;
- if (isJdk9OrLater) {
- debugOpts = String.format("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:%s", debugPort);
- } else {
- debugOpts = String.format("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=%s", debugPort);
- }
- appendEnv(service, ENV_DEBUG_OPTS, debugOpts);
-
- //mapping debug port
- if (service.getPorts() == null) {
- service.setPorts(new ArrayList<>());
- }
- service.getPorts().add(debugPort + ":" + debugPort);
- }
- }
- if (service.getWaitTimeout() > 0) {
- setEnv(service, ENV_WAIT_TIMEOUT, service.getWaitTimeout() + "");
- }
-
- if ("app".equals(type)) {
- String mainClass = service.getMainClass();
- if (StringUtils.isBlank(mainClass)) {
- throw new RuntimeException("Missing 'mainClass' for app service [" + serviceName + "]");
- }
- //set SERVICE_TYPE
- setEnv(service, ENV_SERVICE_TYPE, type);
- //set mainClass env
- setEnv(service, ENV_APP_MAIN_CLASS, mainClass);
- //set SCENARIO_HOME
- setEnv(service, ENV_SCENARIO_HOME, scenarioHome);
-
- boolean addHealthcheck = false;
- //set check_log env
- if (StringUtils.isNotBlank(service.getCheckLog())) {
- addHealthcheck = true;
- setEnv(service, ENV_CHECK_LOG, service.getCheckLog());
- }
-
- //set check ports
- if (isNotEmpty(service.getCheckPorts())) {
- addHealthcheck = true;
- String str = convertAddrPortsToString(service.getCheckPorts());
- setEnv(service, ENV_CHECK_PORTS, str);
- }
-
- //add healthcheck
- if (addHealthcheck) {
- if (service.getHealthcheck() == null) {
- Map<String, Object> healthcheckMap = new LinkedHashMap<>();
- service.setHealthcheck(healthcheckMap);
- }
- Map<String, Object> healthcheck = service.getHealthcheck();
- healthcheck.putIfAbsent("test", Arrays.asList("CMD", "/usr/local/dubbo/healthcheck.sh"));
- healthcheck.putIfAbsent("interval", "5s");
- healthcheck.putIfAbsent("timeout", "5s");
- healthcheck.putIfAbsent("retries", 20);
- healthcheck.putIfAbsent("start_period", "60s");
- }
- } else if ("test".equals(type)) {
- String mainClass = service.getMainClass();
- if (StringUtils.isNotBlank(mainClass)) {
- throw new RuntimeException("Illegal attribute 'mainClass' for test service [" + serviceName + "]");
- }
- //set SERVICE_TYPE
- setEnv(service, ENV_SERVICE_TYPE, type);
-
- //set TEST_PATTERNS
- if (isNotEmpty(service.getTests())) {
- String str = StringUtils.join(service.getTests(), ';');
- setEnv(service, ENV_TEST_PATTERNS, str);
- }
- } else {
- throw new RuntimeException("Illegal service type: " + type);
- }
- }
-
- // set hostname to serviceId if absent
- if (StringUtils.isBlank(service.getHostname())) {
- service.setHostname(serviceName);
- }
-
- //set jvmFlags
- if (isNotEmpty(service.getJvmFlags())) {
- String str = StringUtils.join(service.getJvmFlags(), ' ');
- appendEnv(service, ENV_JAVA_OPTS, str);
- }
-
- //set systemProps
- List<String> systemProps = mergeSystemProps(caseSystemProps, service.getSystemProps());
- if (isNotEmpty(systemProps)) {
- String str = convertSystemPropsToJvmFlags(systemProps);
- appendEnv(service, ENV_JAVA_OPTS, str);
- }
-
- if (service.getHealthcheck() != null) {
- healthcheckServices.add(serviceName);
- }
- }
- }
-
- private void appendEnv(ServiceComponent service, String name, String value) {
- String prefix = name + "=";
- List<String> environments = service.getEnvironment();
- if (environments == null) {
- environments = new ArrayList<>();
- service.setEnvironment(environments);
- }
- for (int i = 0; i < environments.size(); i++) {
- String env = environments.get(i);
- if (env.startsWith(prefix)) {
- // append to exist env
- env += " " + value;
- environments.set(i, env);
- return;
- }
- }
- environments.add(name + "=" + value);
- }
-
- private void setEnv(ServiceComponent service, String name, String value) {
- List<String> environments = service.getEnvironment();
- addOrReplaceKVEntry(environments, name, value);
- }
-
- private void addOrReplaceKVEntry(List<String> map, String name, String value) {
- String prefix = name + "=";
- for (int i = 0; i < map.size(); i++) {
- String env = map.get(i);
- if (env.startsWith(prefix)) {
- //replace old env
- env = name + "=" + value;
- map.set(i, env);
- return;
- }
- }
- map.add(name + "=" + value);
- }
-
- //convert systemProp key=value to -Dkey=value
- private String convertSystemPropsToJvmFlags(List<String> systemProps) {
- StringBuilder sb = new StringBuilder();
- for (String propkv : systemProps) {
- sb.append("-D").append(propkv).append(' ');
- }
- return sb.toString();
- }
-
- private boolean isNotEmpty(List<String> list) {
- return list != null && list.size() > 0;
- }
-
- private String convertAddrPortsToString(List<String> addrPorts) {
- StringBuilder sb = new StringBuilder();
- for (String addrPort : addrPorts) {
- if (!addrPort.contains(":")) {
- addrPort = "127.0.0.1" + ":" + addrPort;
- }
- sb.append(addrPort).append(";");
- }
- return sb.toString();
- }
-
- private String toAbsolutePath(String path) throws IOException {
- File file = new File(path);
- if (file.isAbsolute()) {
- return file.getCanonicalPath();
- }
- //relative path to basedir of configuration file
- return new File(configBasedir, path).getCanonicalPath();
- }
-
- private boolean isAppOrTestService(String type) {
- if (type == null) {
- return false;
- }
- switch (type) {
- case "app":
- case "test":
- return true;
- }
- throw new RuntimeException("Illegal service type: " + type);
- }
-
- private Pattern pattern = Pattern.compile("\\$\\{(.+?)}");
-
- private String replaceHolders(String str, Map<String, String> props) {
- StringBuffer buf = new StringBuffer(str.length());
- Matcher matcher = pattern.matcher(str);
- while (matcher.find()) {
- String var = matcher.group(1);
- String value = props.get(var);
- matcher.appendReplacement(buf, value != null ? value : matcher.group());
- }
- matcher.appendTail(buf);
- return buf.toString();
- }
-
- @Override
- public ScenarioRunningScriptGenerator scenarioGenerator() {
- return new DockerComposeRunningGenerator();
- }
-
- @Override
- public CaseConfiguration caseConfiguration() {
- return this.configuration;
- }
-
- @Override
- public String scenarioName() {
- return scenarioName;
- }
-
- @Override
- public String scenarioVersion() {
- return System.getProperty("scenario.version");
- }
-
- @Override
- public String testImageVersion() {
- return testImageVersion;
- }
-
- @Override
- public String dockerNetworkName() {
- return (scenarioName() + "-" + testImageVersion()).toLowerCase();
- }
-
- @Override
- public String dockerContainerName() {
- return (scenarioName() + "-" + scenarioVersion() + "-" + testImageVersion()).toLowerCase();
- }
-
- @Override
- public String scenarioHome() {
- return this.scenarioHome;
- }
-
- @Override
- public String outputDir() {
- return scenarioHome;
- }
-
- @Override
- public String jacocoHome() {
- return System.getProperty("jacoco.home");
- }
-
- @Override
- public String debugMode() {
- return isDebug() ? "1" : "0";
- }
-
- private int nextDebugPort() {
- return javaDebugPort++;
- }
-
- @Override
- public Map<String, Object> toMap() {
- CaseConfiguration caseConfiguration = caseConfiguration();
- final Map<String, Object> root = new HashMap<>();
-
- root.put("scenario_home", scenarioHome());
- root.put("scenario_name", scenarioName());
- root.put("scenario_version", scenarioVersion());
- root.put("docker_container_name", dockerContainerName());
- root.put("jacoco_home", jacocoHome());
- root.put("debug_mode", debugMode());
- root.put("docker_compose_file", outputDir() + File.separator + "docker-compose.yml");
- root.put("network_name", dockerNetworkName());
- root.put("timeout", scenarioTimeout);
-
- final StringBuilder removeImagesScript = new StringBuilder();
- List<String> links = new ArrayList<>();
- if (caseConfiguration.getServices() != null) {
- caseConfiguration.getServices().forEach((name, service) -> {
- links.add(service.getHostname());
- if (service.isRemoveOnExit()) {
- removeImagesScript.append("docker rmi ")
- .append(service.getImage())
- .append(System.lineSeparator());
- }
- });
- }
- root.put("removeImagesScript", removeImagesScript.toString());
-
-// add links to test service
-// caseConfiguration.getServices().forEach((name, service) -> {
-// if ("test".equals(service.getType())) {
-// if (service.getLinks() == null) {
-// service.setLinks(new ArrayList<>());
-// }
-// for (String link : links) {
-// if (!StringUtils.equals(link, service.getHostname())) {
-// service.getLinks().add(link);
-// }
-// }
-// }
-// });
-
- root.put("services", convertDockerServices(scenarioVersion(), caseConfiguration.getServices()));
- List<String> testServiceNames = findTestServiceNames(caseConfiguration);
- root.put("test_service_name", testServiceNames.size() > 0 ? testServiceNames.get(0) : "");
-
- return root;
- }
-
- private List<String> findTestServiceNames(CaseConfiguration caseConfiguration) {
- List<String> serviceNames = new ArrayList<>();
- for (Map.Entry<String, ServiceComponent> entry : caseConfiguration.getServices().entrySet()) {
- ServiceComponent service = entry.getValue();
- if ("test".equals(service.getType())) {
- serviceNames.add(entry.getKey());
- }
- }
- return serviceNames;
- }
-
- protected List<DockerService> convertDockerServices(final String version,
- Map<String, ServiceComponent> componentMap) {
- final ArrayList<DockerService> services = new ArrayList<>();
- if (componentMap == null) {
- return services;
- }
- componentMap.forEach((name, dependency) -> {
- DockerService service = new DockerService();
-
- String imageName = dependency.getImage();
- service.setName(name);
- service.setImageName(imageName);
- service.setBuild(dependency.getBuild());
- service.setHostname(dependency.getHostname());
- service.setExpose(dependency.getExpose());
- service.setPorts(dependency.getPorts());
- service.setEntrypoint(dependency.getEntrypoint());
- service.setLinks(dependency.getDepends_on());
-
- //convert depends_on to map
- if (dependency.getDepends_on() != null) {
- Map<String, String> dependsOnMap = new LinkedHashMap<>();
- service.setDepends_on(dependsOnMap);
- for (String serviceName : dependency.getDepends_on()) {
- if (healthcheckServices.contains(serviceName)) {
- dependsOnMap.put(serviceName, "{condition: service_healthy}");
- } else {
- dependsOnMap.put(serviceName, "{condition: service_started}");
- }
- }
- }
-
- //convert healthcheck to string map
- if (dependency.getHealthcheck() != null) {
- Yaml yaml = new Yaml();
- Map<String, Object> healthcheckMap = dependency.getHealthcheck();
- Map<String, String> newMap = new LinkedHashMap<>();
- for (Map.Entry<String, Object> entry : healthcheckMap.entrySet()) {
- String value = yaml.dump(entry.getValue());
- newMap.put(entry.getKey(), value.trim());
- }
- service.setHealthcheck(newMap);
- }
- service.setEnvironment(dependency.getEnvironment());
- service.setVolumes(dependency.getVolumes());
- service.setVolumes_from(dependency.getVolumes_from());
- service.setRemoveOnExit(dependency.isRemoveOnExit());
- services.add(service);
- });
- return services;
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/Constants.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/Constants.java
deleted file mode 100644
index aa669f2d..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/Constants.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-public class Constants {
-
- public static final String ERROR_MSG_FLAG = ":ErrorMsg:";
-
- public static final int EXIT_FAILED = 1;
- public static final int EXIT_UNMATCHED = 100;
- public static final int EXIT_IGNORED = 120;
-
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/DockerComposeRunningGenerator.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/DockerComposeRunningGenerator.java
deleted file mode 100644
index 23074da8..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/DockerComposeRunningGenerator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-import freemarker.template.Configuration;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateExceptionHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.util.Map;
-
-public class DockerComposeRunningGenerator extends AbstractRunningGenerator {
- private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- protected DockerComposeRunningGenerator() {
- }
-
- @Override
- public void generateAdditionFiles(IConfiguration configuration) {
- final Map<String, Object> root = configuration.toMap();
-
- Configuration cfg = new Configuration(Configuration.VERSION_2_3_28);
- try {
- cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/");
- cfg.setDefaultEncoding("UTF-8");
- cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
- cfg.setLogTemplateExceptions(false);
- cfg.setWrapUncheckedExceptions(true);
- cfg.setNumberFormat("computer");
- } catch (Exception e) {
- // never to do this
- }
- try {
- cfg.getTemplate("docker-compose.template")
- .process(root, new FileWriter(new File(configuration.outputDir(), "docker-compose.yml")));
- } catch (TemplateException | IOException e) {
- LOGGER.error("", e);
- }
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/FileUtil.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/FileUtil.java
deleted file mode 100644
index d24d3dc0..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/FileUtil.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-import java.io.DataInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-
-public class FileUtil {
- public static String readFully(String file) throws IOException {
- try (FileInputStream fis = new FileInputStream(file)) {
- return readFully(fis);
- }
- }
-
- public static String readFully(InputStream input) throws IOException {
- DataInputStream dis = new DataInputStream(input);
- byte[] bytes = new byte[input.available()];
- dis.readFully(bytes);
- return new String(bytes, StandardCharsets.UTF_8);
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/IConfiguration.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/IConfiguration.java
deleted file mode 100644
index abebb5d2..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/IConfiguration.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-
-import org.apache.dubbo.scenario.builder.vo.CaseConfiguration;
-
-import java.util.Map;
-
-public interface IConfiguration {
-
- ScenarioRunningScriptGenerator scenarioGenerator();
-
- CaseConfiguration caseConfiguration();
-
- String scenarioName();
-
- String scenarioVersion();
-
- String dockerContainerName();
-
- String dockerNetworkName();
-
- String testImageVersion();
-
- String scenarioHome();
-
- String outputDir();
-
- String jacocoHome();
-
- String debugMode();
-
- Map<String, Object> toMap();
-
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ScenarioBuilderMain.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ScenarioBuilderMain.java
deleted file mode 100644
index 62be59b6..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ScenarioBuilderMain.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-public class ScenarioBuilderMain {
-
- public static void main(String[] args) throws Exception {
- IConfiguration configuration = new ConfigurationImpl();
- configuration.scenarioGenerator().generate(configuration);
- System.out.println("outputDir: " + configuration.outputDir());
- System.exit(0);
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ScenarioRunningScriptGenerator.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ScenarioRunningScriptGenerator.java
deleted file mode 100644
index d824e32b..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ScenarioRunningScriptGenerator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.dubbo.scenario.builder;
-
-
-import org.apache.dubbo.scenario.builder.exception.GenerateFailedException;
-
-public interface ScenarioRunningScriptGenerator {
- void generate(IConfiguration configuration) throws GenerateFailedException;
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/exception/ConfigureFileNotFoundException.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/exception/ConfigureFileNotFoundException.java
deleted file mode 100644
index 156bded3..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/exception/ConfigureFileNotFoundException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.dubbo.scenario.builder.exception;
-
-public class ConfigureFileNotFoundException extends Exception {
- public ConfigureFileNotFoundException() {
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/exception/GenerateFailedException.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/exception/GenerateFailedException.java
deleted file mode 100644
index 4c141c21..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/exception/GenerateFailedException.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.dubbo.scenario.builder.exception;
-
-public class GenerateFailedException extends Exception {
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/CaseConfiguration.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/CaseConfiguration.java
deleted file mode 100644
index 72dab22b..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/CaseConfiguration.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.dubbo.scenario.builder.vo;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class CaseConfiguration {
- private String from;
- private Map<String, String> props;
- private List<String> systemProps;
- private Map<String, ServiceComponent> services;
- private int timeout;
- private String ignoreFor;
-
- public String getFrom() {
- return from;
- }
-
- public void setFrom(String from) {
- this.from = from;
- }
-
- public Map<String, ServiceComponent> getServices() {
- return services;
- }
-
- public void setServices(Map<String, ServiceComponent> services) {
- this.services = services;
- }
-
- public Map<String, String> getProps() {
- return props;
- }
-
- public void setProps(Map<String, String> props) {
- this.props = props;
- }
-
- public List<String> getSystemProps() {
- return systemProps;
- }
-
- public void setSystemProps(List<String> systemProps) {
- this.systemProps = systemProps;
- }
-
- public int getTimeout() {
- return timeout;
- }
-
- public void setTimeout(int timeout) {
- this.timeout = timeout;
- }
-
- public String getIgnoreFor() {
- return ignoreFor;
- }
-
- public void setIgnoreFor(String ignoreFor) {
- this.ignoreFor = ignoreFor;
- }
-
- @Override
- public String toString() {
- return "CaseConfiguration{" +
- "from='" + from + '\'' +
- ", props=" + props +
- ", systemProps=" + systemProps +
- ", services=" + services +
- ", timeout=" + timeout +
- ", ignoreFor='" + ignoreFor + '\'' +
- '}';
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/DockerService.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/DockerService.java
deleted file mode 100644
index 48a27bc8..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/DockerService.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.dubbo.scenario.builder.vo;
-
-import java.util.List;
-import java.util.Map;
-
-public class DockerService {
- private String name;
- private String imageName;
- // docker-compose build dir
- private String build;
- private String hostname;
- private boolean removeOnExit;
- private List<String> links;
- private List<String> expose;
- private List<String> ports;
- private List<String> entrypoint;
- private Map<String, String> healthcheck;
- private Map<String, String> depends_on;
- private List<String> environment;
- private List<String> volumes;
- private List<String> volumes_from;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getImageName() {
- return imageName;
- }
-
- public void setImageName(String imageName) {
- this.imageName = imageName;
- }
-
- public String getBuild() {
- return build;
- }
-
- public void setBuild(String build) {
- this.build = build;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public void setHostname(String hostname) {
- this.hostname = hostname;
- }
-
- public boolean isRemoveOnExit() {
- return removeOnExit;
- }
-
- public void setRemoveOnExit(boolean removeOnExit) {
- this.removeOnExit = removeOnExit;
- }
-
- public List<String> getLinks() {
- return links;
- }
-
- public void setLinks(List<String> links) {
- this.links = links;
- }
-
- public List<String> getExpose() {
- return expose;
- }
-
- public void setExpose(List<String> expose) {
- this.expose = expose;
- }
-
- public List<String> getEntrypoint() {
- return entrypoint;
- }
-
- public void setEntrypoint(List<String> entrypoint) {
- this.entrypoint = entrypoint;
- }
-
- public Map<String, String> getHealthcheck() {
- return healthcheck;
- }
-
- public void setHealthcheck(Map<String, String> healthcheck) {
- this.healthcheck = healthcheck;
- }
-
- public Map<String, String> getDepends_on() {
- return depends_on;
- }
-
- public void setDepends_on(Map<String, String> depends_on) {
- this.depends_on = depends_on;
- }
-
- public List<String> getEnvironment() {
- return environment;
- }
-
- public void setEnvironment(List<String> environment) {
- this.environment = environment;
- }
-
- public List<String> getVolumes() {
- return volumes;
- }
-
- public void setVolumes(List<String> volumes) {
- this.volumes = volumes;
- }
-
- public List<String> getVolumes_from() {
- return volumes_from;
- }
-
- public void setVolumes_from(List<String> volumes_from) {
- this.volumes_from = volumes_from;
- }
-
- public List<String> getPorts() {
- return ports;
- }
-
- public void setPorts(List<String> ports) {
- this.ports = ports;
- }
-
- @Override
- public String toString() {
- return "DockerService{" +
- "name='" + name + '\'' +
- ", imageName='" + imageName + '\'' +
- ", build='" + build + '\'' +
- ", hostname='" + hostname + '\'' +
- ", removeOnExit=" + removeOnExit +
- ", links=" + links +
- ", expose=" + expose +
- ", ports=" + ports +
- ", entrypoint=" + entrypoint +
- ", healthcheck=" + healthcheck +
- ", depends_on=" + depends_on +
- ", environment=" + environment +
- ", volumes=" + volumes +
- ", volumes_from=" + volumes_from +
- '}';
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/ServiceComponent.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/ServiceComponent.java
deleted file mode 100644
index b01abf90..00000000
--- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/vo/ServiceComponent.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * 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.dubbo.scenario.builder.vo;
-
-
-import java.util.List;
-import java.util.Map;
-
-public class ServiceComponent {
- private String image;
- // docker-compose build dir
- private String build;
- private String hostname;
- private String version;
- private boolean removeOnExit = false;
- private List<String> links;
- private List<String> expose;
- private List<String> ports;
- private List<String> entrypoint;
- private List<String> environment;
- private List<String> volumes;
- private List<String> volumes_from;
- private List<String> depends_on;
- private Map<String, Object> healthcheck;
-
- // app attrs
- private String type;
- private String basedir;
- private String mainClass;
- private List<String> waitPortsBeforeRun;
- private int waitTimeout;
- private int runDelay;
- private List<String> checkPorts;
- private String checkLog;
- private List<String> tests;
- private List<String> systemProps;
- private List<String> jvmFlags;
-
- public String getImage() {
- return image;
- }
-
- public void setImage(String image) {
- this.image = image;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public void setHostname(String hostname) {
- this.hostname = hostname;
- }
-
- public String getVersion() {
- return version;
- }
-
- public boolean isRemoveOnExit() {
- return removeOnExit;
- }
-
- public void setRemoveOnExit(boolean removeOnExit) {
- this.removeOnExit = removeOnExit;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public List<String> getLinks() {
- return links;
- }
-
- public void setLinks(List<String> links) {
- this.links = links;
- }
-
- public List<String> getExpose() {
- return expose;
- }
-
- public void setExpose(List<String> expose) {
- this.expose = expose;
- }
-
- public List<String> getEntrypoint() {
- return entrypoint;
- }
-
- public void setEntrypoint(List<String> entrypoint) {
- this.entrypoint = entrypoint;
- }
-
- public List<String> getEnvironment() {
- return environment;
- }
-
- public void setEnvironment(List<String> environment) {
- this.environment = environment;
- }
-
- public List<String> getDepends_on() {
- return depends_on;
- }
-
- public void setDepends_on(List<String> depends_on) {
- this.depends_on = depends_on;
- }
-
- public Map<String, Object> getHealthcheck() {
- return healthcheck;
- }
-
- public void setHealthcheck(Map<String, Object> healthcheck) {
- this.healthcheck = healthcheck;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getBasedir() {
- return basedir;
- }
-
- public void setBasedir(String basedir) {
- this.basedir = basedir;
- }
-
- public String getMainClass() {
- return mainClass;
- }
-
- public void setMainClass(String mainClass) {
- this.mainClass = mainClass;
- }
-
- public List<String> getCheckPorts() {
- return checkPorts;
- }
-
- public void setCheckPorts(List<String> checkPorts) {
- this.checkPorts = checkPorts;
- }
-
- public List<String> getWaitPortsBeforeRun() {
- return waitPortsBeforeRun;
- }
-
- public void setWaitPortsBeforeRun(List<String> waitPortsBeforeRun) {
- this.waitPortsBeforeRun = waitPortsBeforeRun;
- }
-
- public String getCheckLog() {
- return checkLog;
- }
-
- public void setCheckLog(String checkLog) {
- this.checkLog = checkLog;
- }
-
- public int getWaitTimeout() {
- return waitTimeout;
- }
-
- public void setWaitTimeout(int waitTimeout) {
- this.waitTimeout = waitTimeout;
- }
-
- public List<String> getTests() {
- return tests;
- }
-
- public void setTests(List<String> tests) {
- this.tests = tests;
- }
-
- public List<String> getSystemProps() {
- return systemProps;
- }
-
- public void setSystemProps(List<String> systemProps) {
- this.systemProps = systemProps;
- }
-
- public List<String> getJvmFlags() {
- return jvmFlags;
- }
-
- public void setJvmFlags(List<String> jvmFlags) {
- this.jvmFlags = jvmFlags;
- }
-
- public List<String> getVolumes() {
- return volumes;
- }
-
- public void setVolumes(List<String> volumes) {
- this.volumes = volumes;
- }
-
- public List<String> getVolumes_from() {
- return volumes_from;
- }
-
- public void setVolumes_from(List<String> volumes_from) {
- this.volumes_from = volumes_from;
- }
-
- public List<String> getPorts() {
- return ports;
- }
-
- public void setPorts(List<String> ports) {
- this.ports = ports;
- }
-
- public String getBuild() {
- return build;
- }
-
- public void setBuild(String build) {
- this.build = build;
- }
-
- public int getRunDelay() {
- return runDelay;
- }
-
- public void setRunDelay(int runDelay) {
- this.runDelay = runDelay;
- }
-
- @Override
- public String toString() {
- return "ServiceComponent{" +
- "image='" + image + '\'' +
- ", build='" + build + '\'' +
- ", hostname='" + hostname + '\'' +
- ", version='" + version + '\'' +
- ", removeOnExit=" + removeOnExit +
- ", links=" + links +
- ", expose=" + expose +
- ", ports=" + ports +
- ", entrypoint=" + entrypoint +
- ", environment=" + environment +
- ", volumes=" + volumes +
- ", volumes_from=" + volumes_from +
- ", depends_on=" + depends_on +
- ", healthcheck=" + healthcheck +
- ", type='" + type + '\'' +
- ", basedir='" + basedir + '\'' +
- ", mainClass='" + mainClass + '\'' +
- ", waitPortsBeforeRun=" + waitPortsBeforeRun +
- ", waitTimeout=" + waitTimeout +
- ", runDelay=" + runDelay +
- ", checkPorts=" + checkPorts +
- ", checkLog='" + checkLog + '\'' +
- ", tests=" + tests +
- ", systemProps=" + systemProps +
- ", jvmFlags=" + jvmFlags +
- '}';
- }
-}
diff --git a/test/dubbo-scenario-builder/src/main/resources/configs/app-builtin-zookeeper.yml b/test/dubbo-scenario-builder/src/main/resources/configs/app-builtin-zookeeper.yml
deleted file mode 100644
index 4ee3548f..00000000
--- a/test/dubbo-scenario-builder/src/main/resources/configs/app-builtin-zookeeper.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-# 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.
-
-# example:
-
-#from: app-builtin-zookeeper.yml
-#props:
-# project_name: dubbo-samples-annotation
-# main_class: org.apache.dubbo.samples.annotation.AnnotationProviderBootstrap
-# zookeeper_port: 2181
-# dubbo_port: 20880
-
-
-props:
- # project_name: dubbo-samples-xxx
- # main_class: org.apache.dubbo.samples.xxx.XxxProviderBootstrap
- project_dir: .
- zookeeper_port: 2181
- dubbo_port: 20880
-
-services:
- ${project_name}:
- type: app
- basedir: ${project_dir}
- mainClass: ${main_class}
- systemProps:
- - zookeeper.address=${project_name}
- - zookeeper.port=${zookeeper_port}
- checkPorts:
- - ${zookeeper_port}
- - ${dubbo_port}
- checkLog: "dubbo service started"
-
- ${project_name}-test:
- type: test
- basedir: ${project_dir}
- tests:
- - "**/*IT.class"
- systemProps:
- - zookeeper.address=${project_name}
- - zookeeper.port=${zookeeper_port}
- - dubbo.address=${project_name}
- - dubbo.port=${dubbo_port}
- waitPortsBeforeRun:
- - ${project_name}:${zookeeper_port}
- - ${project_name}:${dubbo_port}
- depends_on:
- - ${project_name}
diff --git a/test/dubbo-scenario-builder/src/main/resources/configs/app-external-zookeeper.yml b/test/dubbo-scenario-builder/src/main/resources/configs/app-external-zookeeper.yml
deleted file mode 100644
index 57acbc8a..00000000
--- a/test/dubbo-scenario-builder/src/main/resources/configs/app-external-zookeeper.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-# 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.
-
-# example:
-
-#from: app-external-zookeeper.yml
-#props:
-# project_name: dubbo-samples-annotation
-# main_class: org.apache.dubbo.samples.annotation.AnnotationProviderBootstrap
-# dubbo_port: 20880
-# zookeeper_version: latest
-
-
-props:
- # project_name: dubbo-samples-xxx
- # main_class: org.apache.dubbo.samples.xxx.XxxProviderBootstrap
- project_dir: .
- dubbo_port: 20880
- zookeeper_version: latest
-
-services:
- zookeeper:
- image: zookeeper:${zookeeper_version}
-
- ${project_name}:
- type: app
- basedir: ${project_dir}
- mainClass: ${main_class}
- systemProps:
- - zookeeper.address=zookeeper
- - zookeeper.port=2181
- waitPortsBeforeRun:
- - zookeeper:2181
- checkPorts:
- - ${dubbo_port}
- checkLog: "dubbo service started"
-
- ${project_name}-test:
- type: test
- basedir: ${project_dir}
- tests:
- - "**/*IT.class"
- systemProps:
- - zookeeper.address=zookeeper
- - zookeeper.port=2181
- - dubbo.address=${project_name}
- - dubbo.port=${dubbo_port}
- waitPortsBeforeRun:
- - zookeeper:2181
- - ${project_name}:${dubbo_port}
- depends_on:
- - ${project_name}
diff --git a/test/dubbo-scenario-builder/src/main/resources/docker-compose.template b/test/dubbo-scenario-builder/src/main/resources/docker-compose.template
deleted file mode 100644
index e325f704..00000000
--- a/test/dubbo-scenario-builder/src/main/resources/docker-compose.template
+++ /dev/null
@@ -1,93 +0,0 @@
-<#--
- ~ 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.4'
-
-networks:
- default:
- name: ${network_name}
-
-services:
-<#list services as service>
- ${service.name}:
- <#if service.imageName?has_content>
- image: ${service.imageName}
- </#if>
- hostname: ${service.hostname}
- <#if service.build?has_content>
- build: ${service.build}
- </#if>
- <#if service.volumes??>
- volumes:
- <#list service.volumes as volume>
- - ${volume}
- </#list>
- </#if>
- <#if service.volumes_from??>
- volumes_from:
- <#list service.volumes_from as volume>
- - ${volume}
- </#list>
- </#if>
- <#if service.environment??>
- environment:
- <#list service.environment as environment>
- - ${environment}
- </#list>
- </#if>
- <#if service.expose??>
- expose:
- <#list service.expose as expose>
- - ${expose}
- </#list>
- </#if>
- <#if service.ports??>
- ports:
- <#list service.ports as port>
- - ${port}
- </#list>
- </#if>
- <#if service.startScript??>
- command:
- <#list service.startScript as startScript>
- - ${startScript}
- </#list>
- </#if>
- <#if service.depends_on??>
- depends_on:
- <#list service.depends_on as name,value>
- ${name}: ${value}
- </#list>
- </#if>
- <#if service.entrypoint??>
- entrypoint:
- <#list service.entrypoint as item>
- - ${item}
- </#list>
- </#if>
- <#if service.healthcheck??>
- healthcheck:
- <#list service.healthcheck as key,value>
- ${key}: ${value}
- </#list>
- </#if>
- <#if service.links??>
- links:
- <#list service.links as item>
- - ${item}
- </#list>
- </#if>
-</#list>
diff --git a/test/dubbo-scenario-builder/src/main/resources/logback.xml b/test/dubbo-scenario-builder/src/main/resources/logback.xml
deleted file mode 100644
index 3b168be2..00000000
--- a/test/dubbo-scenario-builder/src/main/resources/logback.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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.
- -->
-
-<configuration>
-
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n
- </pattern>
- </encoder>
- </appender>
-
- <!-- <appender name="file"-->
- <!-- class="ch.qos.logback.core.rolling.RollingFileAppender">-->
- <!-- <File>test.log</File>-->
- <!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
- <!-- <FileNamePattern>test-%d{yyyy-MM-dd}.%i.log-->
- <!-- </FileNamePattern>-->
- <!-- <MaxHistory>10</MaxHistory>-->
- <!-- <TimeBasedFileNamingAndTriggeringPolicy-->
- <!-- class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">-->
- <!-- <MaxFileSize>5MB</MaxFileSize>-->
- <!-- </TimeBasedFileNamingAndTriggeringPolicy>-->
- <!-- </rollingPolicy>-->
- <!-- <layout class="ch.qos.logback.classic.PatternLayout">-->
- <!-- <pattern>[%-5level] %d{HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n-->
- <!-- </pattern>-->
- <!-- </layout>-->
- <!-- </appender>-->
-
- <root level="info">
- <!-- <appender-ref ref="file" /> -->
- <appender-ref ref="console"/>
- </root>
-
-</configuration>
diff --git a/test/dubbo-scenario-builder/src/main/resources/scenario.sh b/test/dubbo-scenario-builder/src/main/resources/scenario.sh
deleted file mode 100644
index e39f3101..00000000
--- a/test/dubbo-scenario-builder/src/main/resources/scenario.sh
+++ /dev/null
@@ -1,228 +0,0 @@
-#!/usr/bin/env 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.
-
-# constants
-ERROR_MSG_FLAG=":ErrorMsg:"
-
-
-PRG="$0"
-PRGDIR=`dirname "$PRG"`
-[ -z "$SCENARIO_HOME" ] && SCENARIO_HOME=`cd "$PRGDIR" >/dev/null; pwd`
-cd $SCENARIO_HOME
-
-# set vars from freemarker
-testcase_name=${scenario_name}-${scenario_version}
-debug_mode=${debug_mode}
-timeout=${timeout}
-scenario_name=${scenario_name}
-scenario_version=${scenario_version}
-compose_file="${docker_compose_file}"
-project_name=$(echo "${scenario_name}_${scenario_version}" |sed -e "s/\.//g" |awk '{print tolower($0)}')
-test_service_name="${test_service_name}_1"
-network_name="${network_name}"
-
-service_names=( \
-<#list services as service>
- "${service.name}" \
-</#list>
- )
-
-service_size=${services?size}
-
-export service_names=$service_names
-export service_size=$service_size
-
-<#noparse>
-function redirect_all_container_logs() {
- #redirect logs
- echo "Redirecting all container logs: ${service_names[@]} .." >> $scenario_log
-
- while [ 1==1 ]; do
- redirect_count=0
- for service_name in ${service_names[@]};do
- redirect_container_logs "$service_name"
- result=$?
- if [ "$result" -eq 0 ];then
- redirect_count=$(( redirect_count + 1 ))
- fi
- done
-
- if [ "$redirect_count" == $service_size ];then
- echo "Redirect all containers logs." >> $scenario_log
- break
- fi
-
- sleep 3
- done
-}
-
-function redirect_container_logs() {
- service_name=$1
- container_name=${project_name}_${service_name}_1
- # only redirect once
- ps -ef | grep "docker logs -f $container_name" | grep -v grep > /dev/null
- result=$?
- if [ $result -eq 0 ]; then
- return 0
- fi
-
- container_id=`docker ps -aqf "name=${container_name}"`
- if [[ -z "${container_id}" ]]; then
- return 1
- fi
-
- echo "Redirect container logs: $container_name" >> $scenario_log
- if [ "$debug_mode" == "1" ]; then
- # redirect container logs to file and display debug message
- docker logs -f $container_name 2>&1 | tee $SCENARIO_HOME/logs/${service_name}.log | grep "dt_socket" &
- else
- docker logs -f $container_name &> $SCENARIO_HOME/logs/${service_name}.log &
- fi
- return 0
-
-}
-
-function wait_container_exit() {
- container_name=$1
- start=$2
- timeout=$3
-
- # check and get exit code
- while [ 1 = 1 ];
- do
- sleep 2
- duration=$(( SECONDS - start ))
- if [ $duration -gt $timeout ];then
- echo "wait for container is timeout: $duration s"
- return 1
- fi
-
- container_id=`docker ps -aqf "name=${container_name}"`
- if [[ -z "${container_id}" ]]; then
- continue
- fi
-
- status=`docker inspect $container_name --format='{{.State.Status}}'`
- # test container may pending start cause by depends_on condition
-# result=$?
-# if [ $result -ne 0 ];then
-# echo "check container status failure: $result"
-# return 1
-# fi
- if [ "$status" == "exited" ];then
- return 0
- fi
-
- done
-}
-
-status=1
-
-mkdir -p ${SCENARIO_HOME}/logs
-scenario_log=${SCENARIO_HOME}/logs/scenario.log
-rm -f $scenario_log
-
-echo "[$scenario_name] debug_mode: $debug_mode" >> $scenario_log
-echo "[$scenario_name] timeout: $timeout" >> $scenario_log
-
-#Starting test containers
-container_name="${project_name}_${test_service_name}"
-
-#kill and clean first
-echo "[$scenario_name] Killing containers .." | tee -a $scenario_log
-docker-compose -p ${project_name} -f ${compose_file} kill 2>&1 | tee -a $scenario_log > /dev/null
-
-echo "[$scenario_name] Removing containers .." | tee -a $scenario_log
-docker-compose -p ${project_name} -f ${compose_file} rm -f 2>&1 | tee -a $scenario_log > /dev/null
-
-# pull images
-# TODO check pull timeout?
-#pull_time=$SECONDS
-#echo "[$scenario_name] Pulling images .." | tee -a $scenario_log
-#docker-compose -p ${project_name} -f ${compose_file} pull --ignore-pull-failures 2>&1 <<< "NNN" | tee -a $scenario_log > /dev/null
-#echo "Pull images cost: $((SECONDS - pull_time)) s"
-
-#run async, cause depends_on service healthy blocking docker-compose up
-redirect_all_container_logs &
-
-# start time
-start=$SECONDS
-
-# complete pull fail interactive by <<< "NN"
-echo "[$scenario_name] Starting containers .." | tee -a $scenario_log
-docker-compose -p ${project_name} -f ${compose_file} up -d 2>&1 <<< "NNN" | tee -a $scenario_log > /dev/null
-
-sleep 5
-
-# test container may pending start cause by depends_on condition
-#container_id=`docker ps -aqf "name=${container_name}"`
-#if [[ -z "${container_id}" ]]; then
-# echo "[$scenario_name] docker startup failure!" | tee -a $scenario_log
-# status=1
-#else
- echo "[$scenario_name] Waiting for test container .." | tee -a $scenario_log
- # check and get exit code
- wait_container_exit ${container_name} $start $timeout
- result=$?
- if [ $result -eq 0 ]; then
- result=`docker inspect ${container_name} --format='{{.State.ExitCode}}'`
- if [ $result -eq 0 ]; then
- status=0
- echo "[$scenario_name] Run tests successfully" | tee -a $scenario_log
- else
- status=$result
- echo "[$scenario_name] $ERROR_MSG_FLAG Run tests failed" | tee -a $scenario_log
- fi
- else
- status=1
- echo "[$scenario_name] $ERROR_MSG_FLAG Run tests timeout" | tee -a $scenario_log
- fi
-
- if [[ "$debug_mode" == "1" ]]; then
- echo "[$scenario_name] Waiting for debugging .." | tee -a $scenario_log
- echo "[$scenario_name] Please type 'Ctrl + C' or run the script './kill-tests.sh' to end debugging .." | tee -a $scenario_log
- # idle waiting for abort from user
- read -r -d '' _ </dev/tty
- fi
-
- echo "[$scenario_name] Stopping containers .." | tee -a $scenario_log
- docker-compose -p ${project_name} -f ${compose_file} kill 2>&1 | tee -a $scenario_log > /dev/null
-#fi
-
-if [[ $status == 0 ]];then
- docker-compose -p $project_name -f $compose_file rm -f 2>&1 | tee -a $scenario_log > /dev/null
- ${removeImagesScript}
-else
- for service_name in ${service_names[@]};do
- service_container_name=${project_name}_${service_name}_1
- docker wait $service_container_name > /dev/null
-
- echo "docker inspect $service_container_name :" >> $scenario_log
- docker inspect $service_container_name >> $scenario_log
- echo "" >> $scenario_log
-
- docker logs -f $service_container_name &> $SCENARIO_HOME/logs/${service_name}.log
- done
-fi
-
-# rm network
-docker network rm $network_name 2>&1 | tee -a $scenario_log > /dev/null
-
-exit $status
-
-</#noparse>
\ No newline at end of file
diff --git a/test/dubbo-test-runner/build.sh b/test/dubbo-test-runner/build.sh
deleted file mode 100755
index 5ee631f0..00000000
--- a/test/dubbo-test-runner/build.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-JAVA_VER=${JAVA_VER:-8}
-
-DOCKER_DIR=$DIR/target/docker
-
-echo "Building dubbo-test-runner .."
-echo "Java version: $JAVA_VER"
-cd $DIR
-mvn clean package -DskipTests
-result=$?
-if [ $result -ne 0 ]; then
- echo "Build dubbo-test-runner failure"
- exit $result
-fi
-
-mkdir -p $DOCKER_DIR
-cp -r $DIR/src/docker/* $DOCKER_DIR/
-cp $DIR/target/dubbo-test-runner-*-jar-with-dependencies.jar $DOCKER_DIR/dubbo-test-runner.jar
-
-cd $DOCKER_DIR
-docker build -t dubbo/sample-test:$JAVA_VER . --build-arg DEBIAN_MIRROR=$DEBIAN_MIRROR --build-arg JAVA_VER=$JAVA_VER
diff --git a/test/dubbo-test-runner/pom.xml b/test/dubbo-test-runner/pom.xml
deleted file mode 100644
index fd4d09f8..00000000
--- a/test/dubbo-test-runner/pom.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<!--
- 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>dubbo-extensions-test</artifactId>
- <groupId>org.apache.dubbo.extensions</groupId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>dubbo-test-runner</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>surefire-junit4</artifactId>
- <version>2.22.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>maven-surefire-common</artifactId>
- <version>2.22.2</version>
- <exclusions>
- <exclusion>
- <artifactId>maven-core</artifactId>
- <groupId>org.apache.maven</groupId>
- </exclusion>
- <exclusion>
- <artifactId>maven-plugin-annotations</artifactId>
- <groupId>org.apache.maven.plugin-tools</groupId>
- </exclusion>
- <exclusion>
- <artifactId>maven-plugin-descriptor</artifactId>
- <groupId>org.apache.maven</groupId>
- </exclusion>
- <exclusion>
- <artifactId>maven-project</artifactId>
- <groupId>org.apache.maven</groupId>
- </exclusion>
- <exclusion>
- <artifactId>asm</artifactId>
- <groupId>org.ow2.asm</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>3.3.0</version>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <archive>
- <manifest>
- <mainClass>org.apache.dubbo.test.runner.TestRunnerMain</mainClass>
- </manifest>
- </archive>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id> <!-- this is used for inheritance merges -->
- <phase>package</phase> <!-- bind to the packaging phase -->
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/test/dubbo-test-runner/src/docker/Dockerfile b/test/dubbo-test-runner/src/docker/Dockerfile
deleted file mode 100644
index c99668ac..00000000
--- a/test/dubbo-test-runner/src/docker/Dockerfile
+++ /dev/null
@@ -1,61 +0,0 @@
-# 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.
-
-ARG JAVA_VER=8
-FROM openjdk:$JAVA_VER
-
-ARG DEBIAN_MIRROR
-RUN if [ -n "$DEBIAN_MIRROR" ]; then \
- sed -i "s@http://deb.debian.org@${DEBIAN_MIRROR}@g" /etc/apt/sources.list && \
- sed -i "s@http://security.debian.org@${DEBIAN_MIRROR}@g" /etc/apt/sources.list && \
- cat /etc/apt/sources.list ; fi
-
-RUN apt-get update && \
- apt-get install -y telnet && \
- rm -rf /var/lib/apt/lists/*
-
-VOLUME /usr/local/dubbo/app /usr/local/dubbo/logs
-
-# JAVA_OPTS/DEBUG_OPTS: Jvm flags
-# SERVICE_TYPE: app, test
-# WAIT_PORTS_BEFORE_RUN: wait ports before run
-# WAIT_TIMEOUT: wait ports timeout
-# TEST_PATTERNS: test class pattern
-# classpath: assert mounting $project_dir/target:/usr/local/dubbo/app/
-# CHECK_PORTS: health check ports
-# CHECK_LOG: health check log
-ENV JAVA_OPTS="" \
- DEBUG_OPTS="" \
- TEST_CLASSES_DIR="/usr/local/dubbo/app/test-classes" \
- APP_CLASSES_DIR="/usr/local/dubbo/app/classes" \
- APP_DEPENDENCY_DIR="/usr/local/dubbo/app/dependency" \
- SERVICE_NAME="" \
- SERVICE_TYPE="app" \
- WAIT_TIMEOUT=60 \
- WAIT_PORTS_BEFORE_RUN="" \
- RUN_DELAY=0 \
- APP_MAIN_CLASS="" \
- CHECK_PORTS="" \
- CHECK_LOG="" \
- TEST_PATTERNS="**/*IT.class"
-
-
-ADD dubbo-test-runner.jar *.sh /usr/local/dubbo/
-
-WORKDIR /usr/local/dubbo/
-#ENTRYPOINT exec java $JAVA_OPTS -jar dubbo-test-runner.jar $TEST_CLASSES_DIR $APP_CLASSES_DIR $APP_DEPENDENCY_DIR
-ENTRYPOINT ["bash", "-x", "./run.sh"]
-
-
diff --git a/test/dubbo-test-runner/src/docker/healthcheck.sh b/test/dubbo-test-runner/src/docker/healthcheck.sh
deleted file mode 100755
index 926ff88b..00000000
--- a/test/dubbo-test-runner/src/docker/healthcheck.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-
-if [ "$SERVICE_NAME" == "" ]; then
- echo "Missing env 'SERVICE_NAME'"
- return 1
-fi
-
-if [ "$CHECK_LOG" == "" ] && [ "$CHECK_PORTS" == "" ]; then
- echo "Require at least one of the env: 'CHECK_LOG' or 'CHECK_PORTS'"
- return 1
-fi
-
-DIR=/usr/local/dubbo/
-cd $DIR
-
-LOG_DIR=/usr/local/dubbo/logs
-if [ ! -d $LOG_DIR ];then
- mkdir -p $LOG_DIR
-fi
-LOG_FILE=$LOG_DIR/$SERVICE_NAME.log
-
-source $DIR/utils.sh
-
-# check ports
-if [ "$CHECK_PORTS" != "" ]; then
- split_and_check_tcp_ports "$CHECK_PORTS" $SECONDS 1
- result=$?
- if [ $result -ne 0 ]; then
- echo "check ports failure"
- exit $result
- fi
-fi
-
-# check log
-if [ "$CHECK_LOG" != "" ]; then
- check_log "$LOG_FILE" "$CHECK_LOG" $SECONDS 1
- result=$?
- if [ $result -ne 0 ]; then
- echo "check log failure"
- exit $result
- fi
-fi
-
diff --git a/test/dubbo-test-runner/src/docker/run-dubbo-app.sh b/test/dubbo-test-runner/src/docker/run-dubbo-app.sh
deleted file mode 100755
index 12fda3f9..00000000
--- a/test/dubbo-test-runner/src/docker/run-dubbo-app.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-
-DIR=/usr/local/dubbo/
-cd $DIR
-
-source $DIR/utils.sh
-
-if [ "$APP_MAIN_CLASS" == "" ]; then
- echo "Missing env 'APP_MAIN_CLASS' for app service"
- return 1
-fi
-
-# wait ports before run app: WAIT_PORTS_BEFORE_RUN=host:port;host:port
-if [ "$WAIT_PORTS_BEFORE_RUN" != "" ]; then
- echo "Waiting ports before run app .."
- split_and_check_tcp_ports "$WAIT_PORTS_BEFORE_RUN" $SECONDS $WAIT_TIMEOUT
- result=$?
- if [ $result -ne 0 ]; then
- echo "Wait ports before run app failure"
- exit $result
- fi
-fi
-
-#delay start
-if [ $RUN_DELAY -gt 0 ]; then
- echo "Delay $RUN_DELAY s."
- sleep $RUN_DELAY
-fi
-
-echo "Running app : [$APP_MAIN_CLASS] ..."
-start=$SECONDS
-java $JAVA_OPTS $DEBUG_OPTS -cp "$APP_CLASSES_DIR:$APP_DEPENDENCY_DIR/*" $APP_MAIN_CLASS 2>&1 &
-pid=$!
-
-echo "Wait for process to exit: $pid .."
-wait $pid
-result=$?
-if [ $result -ne 0 ]; then
- exit $result
-fi
-
diff --git a/test/dubbo-test-runner/src/docker/run-dubbo-test.sh b/test/dubbo-test-runner/src/docker/run-dubbo-test.sh
deleted file mode 100755
index 2ae882ed..00000000
--- a/test/dubbo-test-runner/src/docker/run-dubbo-test.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-DIR=/usr/local/dubbo/
-
-source $DIR/utils.sh
-
-cd $DIR
-
-if [ "$TEST_CLASSES_DIR" == "" ]; then
- echo "Missing env 'TEST_CLASSES_DIR' for test service"
- return 1
-fi
-
-# wait ports before run app: WAIT_PORTS_BEFORE_RUN=host:port;host:port
-if [ "$WAIT_PORTS_BEFORE_RUN" != "" ]; then
- echo "Waiting ports before run test .."
- # check ports
- split_and_check_tcp_ports "$WAIT_PORTS_BEFORE_RUN" $SECONDS $WAIT_TIMEOUT
- result=$?
- if [ $result -ne 0 ]; then
- echo "Wait ports before run test failure"
- exit $result
- fi
-fi
-
-# At least delay 1 second
-if [ $RUN_DELAY -le 0 ]; then
- RUN_DELAY=1
-fi
-
-#delay start
-if [ $RUN_DELAY -gt 0 ]; then
- echo "Delay $RUN_DELAY s."
- sleep $RUN_DELAY
-fi
-
-# run testcase
-echo "Running tests ..."
-report_dir=$DIR/app/test-reports
-
-# Fix Class loading problem in java9+: CompletableFuture.supplyAsync() is executed in the ForkJoinWorkerThread
-# and it only uses system classloader to load classes instead of the IsolatedClassLoader
-classpath=dubbo-test-runner.jar:$TEST_CLASSES_DIR:$APP_CLASSES_DIR:$APP_DEPENDENCY_DIR/*
-java $JAVA_OPTS $DEBUG_OPTS -cp $classpath org.apache.dubbo.test.runner.TestRunnerMain "$TEST_CLASSES_DIR" "$APP_CLASSES_DIR" "$APP_DEPENDENCY_DIR" "$report_dir" "$TEST_PATTERNS" 2>&1
-result=$?
-if [ $result -ne 0 ]; then
- echo "Run tests failure"
- exit $result
-else
- echo "Run tests successfully"
-fi
diff --git a/test/dubbo-test-runner/src/docker/run.sh b/test/dubbo-test-runner/src/docker/run.sh
deleted file mode 100755
index fa4e938d..00000000
--- a/test/dubbo-test-runner/src/docker/run.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-
-echo "Start at: $(date "+%Y-%m-%d %H:%M:%S")"
-
-DIR=/usr/local/dubbo/
-cd $DIR
-
-#LOG_DIR=/usr/local/dubbo/logs
-#if [ ! -d $LOG_DIR ];then
-# mkdir -p $LOG_DIR
-#fi
-#LOG_FILE=$LOG_DIR/$SERVICE_NAME.log
-#rm -f $LOG_FILE
-
-source $DIR/utils.sh
-
-function print_log() {
- msg=$1
- echo $msg
-# echo $msg | tee -a $LOG_FILE
-}
-
-if [ "$SERVICE_NAME" == "" ]; then
- print_log "Missing env 'SERVICE_NAME'"
- return 1
-fi
-
-if [ "$APP_CLASSES_DIR" == "" ]; then
- print_log "Missing env 'APP_CLASSES_DIR'"
- return 1
-fi
-
-if [ "$APP_DEPENDENCY_DIR" == "" ]; then
- print_log "Missing env 'APP_DEPENDENCY_DIR'"
- return 1
-fi
-
-
-if [ "$SERVICE_TYPE" == "app" ]; then
- script_file=$DIR/run-dubbo-app.sh
-elif [ "$SERVICE_TYPE" == "test" ]; then
- script_file=$DIR/run-dubbo-test.sh
-fi
-
-/bin/bash -x $script_file 2>&1
-
-#/bin/bash -x $script_file 2>&1 | tee -a $LOG_FILE
-## get proc exitcode before tee, use $PIPESTATUS variable instead of $? (https://stackoverflow.com/a/6871917)
-#result=${PIPESTATUS[0]}
-#exit $result
\ No newline at end of file
diff --git a/test/dubbo-test-runner/src/docker/utils.sh b/test/dubbo-test-runner/src/docker/utils.sh
deleted file mode 100644
index 76e06504..00000000
--- a/test/dubbo-test-runner/src/docker/utils.sh
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/bash
-
-function check_tcp_port() {
- host=$1
- port=$2
- start=$3
- timeout=$4
-
- start=${start:-$SECONDS}
- timeout=${timeout:-60}
-
- if [[ "$host" == "" || "$port" == "" ]]; then
- echo "invalid args, usage: check_tcp_port <host> <port> [start_at_seconds] [timeout_in_seconds]"
- return 1
- fi
-
- echo "checking tcp port [$host:$port] ..."
- for ((i=1; i<=${timeout}; i++));
- do
- # sometimes nc/ping is too slowly, why?
- #nc -zv -w2 $host $port
-
- # connect to remote host:port by telnet, and auto close it
- echo -e '\x1dclose\x0d' | telnet $host $port 2>&1
- result=$?
- if [ $result -eq 0 ]; then
- echo "check tcp port [$host:$port] success."
- return 0
- fi
-
- duration=$(( SECONDS - start ))
- if [ $duration -gt $timeout ];then
- echo "check tcp port [$host:$port] is timeout: $duration s"
- return 1
- fi
- sleep 1
- done
-
- duration=$(( SECONDS - start ))
- echo "check tcp port [$host:$port] is timeout: $duration s"
- return 1
-}
-
-function split_and_check_tcp_ports() {
- addrs_str=$1
- start=$2
- timeout=$3
-
- start=${start:-$SECONDS}
- timeout=${timeout:-60}
- echo "checking tcp ports: $addrs_str, start at: $start, timeout: $timeout"
-
- addr_ports=$(echo $addrs_str | tr ";" "\n")
- for addr_port in $addr_ports
- do
- # process
- host=${addr_port%:*}
- port=${addr_port#*:}
-
- check_tcp_port $host $port $start $timeout
- result=$?
- if [ $result -ne 0 ]; then
- return $result
- fi
- done
-}
-
-# examples
-#sleep 3
-#split_and_check_tcp_ports "$@" $SECONDS 10
-
-
-# check and wait for log message
-function check_log() {
- file="$1"
- match_str="$2"
- start=$3
- timeout=$4
-
- start=${start:-$SECONDS}
- timeout=${timeout:-60}
-
- echo "checking log [$file], matching str: $match_str .."
- for ((i=1; i<=${timeout}; i++));
- do
- grep "$match_str" "$file"
- result=$?
- if [ $result -eq 0 ];then
- return 0
- fi
-
- duration=$(( SECONDS - start ))
- if [ $duration -gt $timeout ];then
- echo "check log [$file] for matching string [$match_str] is timeout: $duration s"
- return 1
- fi
-
- sleep 2
- done
-
- duration=$(( SECONDS - start ))
- echo "check log [$file] for matching string [$match_str] is timeout: $duration s"
- return 1
-}
-
-# examples
-#sleep 3
-#check_log "$@" $SECONDS 10
diff --git a/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/ClassLoaderUtils.java b/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/ClassLoaderUtils.java
deleted file mode 100644
index 6dbce406..00000000
--- a/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/ClassLoaderUtils.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.dubbo.test.runner;
-
-import sun.misc.Unsafe;
-
-import java.lang.reflect.Field;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-
-/*
- * from https://gist.github.com/hengyunabc/644f8e84908b7b405c532a51d8e34ba9
- */
-public class ClassLoaderUtils {
- @SuppressWarnings({"restriction", "unchecked"})
- public static URL[] getUrls(ClassLoader classLoader) {
- if (classLoader instanceof URLClassLoader) {
- return ((URLClassLoader) classLoader).getURLs();
- }
-
- // jdk9
- if (classLoader.getClass().getName().startsWith("jdk.internal.loader.ClassLoaders$")) {
- try {
- Field field = Unsafe.class.getDeclaredField("theUnsafe");
- field.setAccessible(true);
- Unsafe unsafe = (Unsafe) field.get(null);
-
- // jdk.internal.loader.ClassLoaders.AppClassLoader.ucp
- Field ucpField = classLoader.getClass().getDeclaredField("ucp");
- long ucpFieldOffset = unsafe.objectFieldOffset(ucpField);
- Object ucpObject = unsafe.getObject(classLoader, ucpFieldOffset);
-
- // jdk.internal.loader.URLClassPath.path
- Field pathField = ucpField.getType().getDeclaredField("path");
- long pathFieldOffset = unsafe.objectFieldOffset(pathField);
- ArrayList<URL> path = (ArrayList<URL>) unsafe.getObject(ucpObject, pathFieldOffset);
-
- return path.toArray(new URL[path.size()]);
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
- return null;
- }
-}
diff --git a/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/ClassloaderSurefireStarter.java b/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/ClassloaderSurefireStarter.java
deleted file mode 100644
index 2e91d1a5..00000000
--- a/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/ClassloaderSurefireStarter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.dubbo.test.runner;
-
-import org.apache.maven.plugin.surefire.CommonReflector;
-import org.apache.maven.plugin.surefire.StartupReportConfiguration;
-import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
-import org.apache.maven.surefire.booter.ProviderConfiguration;
-import org.apache.maven.surefire.booter.StartupConfiguration;
-import org.apache.maven.surefire.booter.SurefireExecutionException;
-import org.apache.maven.surefire.suite.RunResult;
-import org.apache.maven.surefire.testset.TestSetFailedException;
-import org.apache.maven.surefire.util.DefaultScanResult;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-import static org.apache.maven.surefire.booter.ProviderFactory.invokeProvider;
-
-/**
- * Starts the provider in specify classloader.
- */
-public class ClassloaderSurefireStarter {
- private final StartupConfiguration startupConfig;
- private final StartupReportConfiguration startupReportConfig;
- private final ProviderConfiguration providerConfig;
- private final ConsoleLogger consoleLogger;
- private ClassLoader testClassLoader;
-
- public ClassloaderSurefireStarter(StartupConfiguration startupConfig,
- ProviderConfiguration providerConfig,
- StartupReportConfiguration startupReportConfig,
- ConsoleLogger consoleLogger,
- ClassLoader testClassLoader) {
- this.startupConfig = startupConfig;
- this.startupReportConfig = startupReportConfig;
- this.providerConfig = providerConfig;
- this.consoleLogger = consoleLogger;
- this.testClassLoader = testClassLoader;
- }
-
- public RunResult runSuitesInProcess(DefaultScanResult scanResult)
- throws SurefireExecutionException, TestSetFailedException {
- // The test classloader must be constructed first to avoid issues with commons-logging until we properly
- // separate the TestNG classloader
-
- Map<String, String> providerProperties = providerConfig.getProviderProperties();
- scanResult.writeTo(providerProperties);
-
- startupConfig.writeSurefireTestClasspathProperty();
-
- CommonReflector surefireReflector = new CommonReflector(testClassLoader);
-
- Object factory = surefireReflector.createReportingReporterFactory(startupReportConfig, consoleLogger);
-
- try {
- return invokeProvider(null, testClassLoader, factory, providerConfig, false, startupConfig, true);
- } catch (InvocationTargetException e) {
- throw new SurefireExecutionException("Exception in provider", e.getTargetException());
- }
- }
-
-}
diff --git a/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/TestRunnerMain.java b/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/TestRunnerMain.java
deleted file mode 100644
index 2558e7b2..00000000
--- a/test/dubbo-test-runner/src/main/java/org/apache/dubbo/test/runner/TestRunnerMain.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * 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.dubbo.test.runner;
-
-
-import org.apache.maven.plugin.surefire.StartupReportConfiguration;
-import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
-import org.apache.maven.plugin.surefire.log.api.PrintStreamLogger;
-import org.apache.maven.plugin.surefire.report.ConsoleReporter;
-import org.apache.maven.plugin.surefire.util.DirectoryScanner;
-import org.apache.maven.surefire.booter.AbstractPathConfiguration;
-import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
-import org.apache.maven.surefire.booter.Classpath;
-import org.apache.maven.surefire.booter.ClasspathConfiguration;
-import org.apache.maven.surefire.booter.ProviderConfiguration;
-import org.apache.maven.surefire.booter.Shutdown;
-import org.apache.maven.surefire.booter.StartupConfiguration;
-import org.apache.maven.surefire.cli.CommandLineOption;
-import org.apache.maven.surefire.junit4.JUnit4Provider;
-import org.apache.maven.surefire.report.ReporterConfiguration;
-import org.apache.maven.surefire.suite.RunResult;
-import org.apache.maven.surefire.testset.DirectoryScannerParameters;
-import org.apache.maven.surefire.testset.RunOrderParameters;
-import org.apache.maven.surefire.testset.TestListResolver;
-import org.apache.maven.surefire.testset.TestRequest;
-import org.apache.maven.surefire.util.DefaultScanResult;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-import static java.util.Collections.emptyList;
-
-public class TestRunnerMain {
-
- public static void main(String[] args) throws Exception {
-
- if (args.length < 4) {
- throw new IllegalArgumentException("Invalid arguments, usage: TestRunnerMain <testClassesDir> <targetClassesDir> <dependencyJarsDir> <reportDir> [test-pattern1;test-pattern2]");
- }
-
- File testClassesDir = new File(args[0]);
- if (!testClassesDir.exists() || !testClassesDir.isDirectory()) {
- throw new IllegalArgumentException("testClassesDir is not exists or is not a directory: " + testClassesDir.getAbsolutePath());
- }
- File targetClassesDir = new File(args[1]);
- if (!targetClassesDir.exists() || !targetClassesDir.isDirectory()) {
- throw new IllegalArgumentException("targetClassesDir is not exists or is not a directory: " + targetClassesDir.getAbsolutePath());
- }
- File dependencyJarsDir = new File(args[2]);
- if (!dependencyJarsDir.exists() || !dependencyJarsDir.isDirectory()) {
- throw new IllegalArgumentException("dependencyJarsDir is not exists or is not a directory: " + dependencyJarsDir.getAbsolutePath());
- }
-
- File reportsDirectory = new File(args[3]);
- reportsDirectory.mkdirs();
- if (!reportsDirectory.exists() || !reportsDirectory.isDirectory()) {
- throw new IllegalArgumentException("reportDir is not exists or is not a directory: " + reportsDirectory.getAbsolutePath());
- }
-
- // tests pattern: **/*IT.class;**/*Test.class
- List<String> tests = new ArrayList<>();
- if (args.length > 4) {
- String[] testPatterns = args[4].split(";");
- for (String pattern : testPatterns) {
- String s = pattern.trim();
- if (s.endsWith(".java")) {
- s = s.replace(".java", ".class");
- }
- tests.add(s);
- }
- }
-
- System.out.println("testClassesDir: " + testClassesDir.getAbsolutePath());
- System.out.println("targetClassesDir: " + targetClassesDir.getAbsolutePath());
- System.out.println("dependencyJarsDir: " + dependencyJarsDir.getAbsolutePath());
- System.out.println("reportsDirectory: " + reportsDirectory.getAbsolutePath());
- System.out.println("test patterns: " + tests);
-
-
- File statisticsFile = new File(reportsDirectory, "test-statistics.txt");
- StartupReportConfiguration startupReportConfiguration = new StartupReportConfiguration(true,
- true,
- ConsoleReporter.PLAIN,
- false,
- true,
- reportsDirectory,
- false,
- "report",
- statisticsFile,
- true,
- 10,
- null,
- "UTF-8",
- false
- );
-
- DirectoryScannerParameters directoryScannerParameters = new DirectoryScannerParameters(testClassesDir,
- emptyList(), emptyList(), emptyList(), false, "");
-
- File runStatisticsFile = new File(reportsDirectory, "run-statistics.txt");
- RunOrderParameters runOrderParameters = new RunOrderParameters((String) null, runStatisticsFile);
-
- TestListResolver requestTests = new TestListResolver(Collections.emptyList());
- TestRequest testRequest = new TestRequest(Collections.emptyList(), testClassesDir, requestTests);
-
- HashMap<String, String> providerProperties = new HashMap<>();
-
- ReporterConfiguration reporterConfiguration = new ReporterConfiguration(reportsDirectory, false);
-
- List<CommandLineOption> cliOptions = new ArrayList<>();
- cliOptions.add(CommandLineOption.LOGGING_LEVEL_ERROR);
- cliOptions.add(CommandLineOption.LOGGING_LEVEL_WARN);
- cliOptions.add(CommandLineOption.LOGGING_LEVEL_INFO);
- cliOptions.add(CommandLineOption.REACTOR_FAIL_FAST);
-
- ProviderConfiguration providerConfiguration = new ProviderConfiguration(
- directoryScannerParameters,
- runOrderParameters,
- false,
- reporterConfiguration,
- null,
- testRequest,
- providerProperties,
- null,
- false,
- cliOptions,
- 0,
- Shutdown.DEFAULT,
- 30
- );
-
- String providerClassName = JUnit4Provider.class.getName();//"org.apache.maven.surefire.junit4.JUnit4Provider";
- Classpath testClasspath = generateTestClasspath(testClassesDir, targetClassesDir, dependencyJarsDir);
- Classpath inprocClasspath = getInprocClasspath();
- Classpath surefireClasspath = inprocClasspath;
- AbstractPathConfiguration classpathConfiguration = new ClasspathConfiguration(
- testClasspath,
- surefireClasspath,
- inprocClasspath,
- false,
- false
- );
-
- ClassLoaderConfiguration classloaderConfiguration = new ClassLoaderConfiguration(false, false);
- StartupConfiguration startupConfiguration = new StartupConfiguration(
- providerClassName,
- classpathConfiguration,
- classloaderConfiguration,
- false,
- false);
-
-
- DefaultScanResult scanResult = getScanResult(testClassesDir, tests);
- ConsoleLogger consoleLogger = new PrintStreamLogger(System.out);
-
- // Fix Class loading problem in java9+:
- // CompletableFuture.supplyAsync() is executed in the ForkJoinWorkerThread
- // and it only uses system classloader to load classes instead of the IsolatedClassLoader
- ClassloaderSurefireStarter testStarter = new ClassloaderSurefireStarter(startupConfiguration, providerConfiguration,
- startupReportConfiguration, consoleLogger, ClassLoader.getSystemClassLoader());
-// InPluginVMSurefireStarter testStarter = new InPluginVMSurefireStarter(startupConfiguration, providerConfiguration,
-// startupReportConfiguration, consoleLogger);
-
- RunResult runResult = testStarter.runSuitesInProcess(scanResult);
- boolean runSuccess = runResult.getCompletedCount() > 0 && runResult.isErrorFree() && !runResult.isTimeout();
-
- String line = "------------------------------------------------------------------------\n";
- consoleLogger.info(String.format(line + "TEST %s, Total: %d, Failures: %d, Errors: %d, Skipped: %d\n" + line,
- runSuccess ? "SUCCESS" : "FAILURE", runResult.getCompletedCount(), runResult.getFailures(), runResult.getErrors(),
- runResult.getSkipped()));
-
-// File tmpDirectory = new File(reportsDirectory, "tmp");
-// tmpDirectory.mkdirs();
-// ForkConfiguration forkConfiguration = new ClasspathForkConfiguration(inprocClasspath, tmpDirectory, null,
-// reportsDirectory, new Properties(), "", System.getenv(), false, 1, true,
-// new Platform(), consoleLogger);
-// ForkStarter forkStarter = new ForkStarter(providerConfiguration,
-// startupConfiguration,
-// forkConfiguration,
-// 30,
-// startupReportConfiguration,
-// consoleLogger);
-// RunResult runResult = forkStarter.run(new SurefireProperties(), scanResult);
-// System.out.println(String.format("RunResult: %d, Failures: %d, Errors: %d, failure: %s",
-// runResult.getCompletedCount(), runResult.getFailures(), runResult.getErrors(), runResult.getFailure()));
-
- if (runSuccess) {
- System.exit(0);
- } else {
- System.exit(1);
- }
- }
-
- public static DefaultScanResult getScanResult(File testClassesDir, Collection<String> tests) {
- DirectoryScanner directoryScanner = new DirectoryScanner(testClassesDir, new TestListResolver(tests));
- return directoryScanner.scan();
- }
-
- private static Classpath getInprocClasspath() {
- List<String> classpath = new ArrayList<>();
- ClassLoader cl = ClassLoader.getSystemClassLoader();
- URL[] urls = ClassLoaderUtils.getUrls(cl);
- for (URL url : urls) {
- classpath.add(url.getFile());
- }
- return new Classpath(classpath);
- }
-
- private static Classpath generateTestClasspath(File testClassesDir, File targetClassDir, File dependenciesDir) {
- List<String> classpath = new ArrayList<>();
- classpath.add(testClassesDir.getAbsolutePath());
- classpath.add(targetClassDir.getAbsolutePath());
-
- File[] jarFiles = dependenciesDir.listFiles((dir, name) -> name.toLowerCase().endsWith(".jar"));
- if (jarFiles != null) {
- for (File jarFile : jarFiles) {
- classpath.add(jarFile.getAbsolutePath());
- }
- }
- return new Classpath(classpath);
- }
-
-}
diff --git a/test/kill-tests.sh b/test/kill-tests.sh
deleted file mode 100755
index 8dbd9044..00000000
--- a/test/kill-tests.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-echo "Killing run-tests.sh .."
-ps -ef | grep run-tests.sh | grep -v grep | awk '{ print $2 }' | xargs -I {} kill {}
-
-echo "Killing scenario.sh .."
-ps -ef | grep scenario.sh | grep -v grep | awk '{ print $2 }' | xargs -I {} kill {}
-
-echo "Killing docker logs procs .."
-ps -ef | grep "docker logs" | grep -v grep | awk '{ print $2 }' | xargs -I {} kill {}
-
-echo "Killing docker-compose .."
-ps -ef | grep "docker-compose" | grep "dubbo-samples" | grep -v grep | awk '{ print $2 }' | xargs -I {} kill {}
-
-echo "Killing dubbo containers .."
-docker ps -a | grep dubbo | awk '{ print $1}' | xargs -I {} docker kill {}
-
-echo "Removing unused networks .."
-docker network prune -f
-
diff --git a/test/pom.xml b/test/pom.xml
deleted file mode 100644
index 93eb50f6..00000000
--- a/test/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>extensions-parent</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>dubbo-extensions-test</artifactId>
- <packaging>pom</packaging>
- <version>${revision}</version>
- <modules>
- <module>dubbo-test-runner</module>
- <module>dubbo-scenario-builder</module>
- <module>scenarios</module>
- </modules>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <dubbo.version>3.2.11</dubbo.version>
- <junit.version>4.13.1</junit.version>
- <spring.version>4.3.30.RELEASE</spring.version>
- </properties>
-
-
-</project>
diff --git a/test/run-tests.sh b/test/run-tests.sh
deleted file mode 100755
index d67ded93..00000000
--- a/test/run-tests.sh
+++ /dev/null
@@ -1,382 +0,0 @@
-#!/bin/bash
-
-TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-WORK_DIR="$(pwd)"
-echo "WorkDir: $WORK_DIR"
-
-#-----------------------------------#
-# environments
-#-----------------------------------#
-JAVA_VER=${JAVA_VER:-8}
-echo "JAVA_VER: $JAVA_VER"
-
-FAIL_FAST=${FAIL_FAST:-0}
-echo "FAIL_FAST: $FAIL_FAST"
-
-SHOW_ERROR_DETAIL=${SHOW_ERROR_DETAIL:-0}
-export SHOW_ERROR_DETAIL=$SHOW_ERROR_DETAIL
-echo "SHOW_ERROR_DETAIL: $SHOW_ERROR_DETAIL"
-
-maxForks=${FORK_COUNT:-2}
-echo "FORK_COUNT: $maxForks"
-
-#debug DEBUG=service1,service2
-#deubg all duboo-xxx: DEBUG=dubbo*
-export DEBUG=$DEBUG
-echo "DEBUG=$DEBUG"
-
-if [ "$MVN_OPTS" != "" ]; then
- export MVN_OPTS=$MVN_OPTS
- echo "MVN_OPTS: $MVN_OPTS"
-fi
-
-if [ "$BUILD_OPTS" == "" ]; then
- BUILD_OPTS="$MVN_OPTS --batch-mode --no-snapshot-updates --no-transfer-progress clean package dependency:copy-dependencies -DskipTests"
-fi
-export BUILD_OPTS=$BUILD_OPTS
-echo "BUILD_OPTS: $BUILD_OPTS"
-
-#-----------------------------------#
-# constants
-#-----------------------------------#
-TEST_SUCCESS="TEST SUCCESS"
-TEST_FAILURE="TEST FAILURE"
-TEST_IGNORED="TEST IGNORED"
-
-ERROR_MSG_FLAG=":ErrorMsg:"
-
-CONFIG_FILE="case-configuration.yml"
-
-# Exit codes
-# ignore testing
-EXIT_IGNORED=120
-
-#-----------------------------------#
-# functions
-#-----------------------------------#
-abspath() { case "$1" in /*) printf "%s\n" "$1" ;; *) printf "%s\n" "$PWD/$1" ;; esac }
-
-function get_error_msg() {
- log_file=$1
- error_msg=$(grep $ERROR_MSG_FLAG $log_file)
- error_msg=${error_msg#*$ERROR_MSG_FLAG}
- echo $error_msg
-}
-
-function print_log_file() {
- scenario_name=$1
- file=$2
-
- if [ -f $file ]; then
- title="$scenario_name log: $(basename $file)"
- echo ""
- echo "----------------------------------------------------------"
- echo " $title"
- echo "----------------------------------------------------------"
- cat $file
- echo ""
- fi
-}
-
-function check_test_image() {
- #check dubbo/sample-test image and version
- test_image="dubbo/sample-test:$JAVA_VER"
- echo "Checking test image [$test_image] .. "
- docker images --format 'table {{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Size}}' | grep $test_image
- result=$?
- if [ $result != 0 ]; then
- echo "Test image not found: $test_image, please run 'bash ./build-test-image.sh' first."
- exit 1
- fi
-}
-
-function process_case() {
- case_dir=$1
- case_no=$2
-
- if [ -f $case_dir ]; then
- case_dir=$(dirname $case_dir)
- fi
-
- file=$case_dir/$CONFIG_FILE
- if [ ! -f $file ]; then
- echo "$TEST_FAILURE: case config not found: $file" | tee -a $testResultFile
- return 1
- fi
-
- case_start_time=$SECONDS
- project_home=$(dirname $file)
- scenario_home=$project_home/target
- scenario_name=$(basename $project_home)
- log_prefix="[${case_no}/${totalCount}] [$scenario_name]"
- echo "$log_prefix Processing : $project_home .."
-
- start_time=$SECONDS
- log_prefix="[${case_no}/${totalCount}] [$scenario_name]"
-
- # run test using version profile
- echo "$log_prefix Building project : $scenario_name .."
- cd $project_home
-
- # clean target manual, avoid 'mvn clean' failed with 'Permission denied' in github actions
- find . -name target -d | xargs -I {} rm -rf {}
- target_dirs=$(find . -name target -d)
- if [ "$target_dirs" != "" ]; then
- echo "$log_prefix Force delete target dirs"
- find . -name target -d | xargs -I {} sudo rm -rf {}
- fi
-
- mvn $BUILD_OPTS &>$project_home/mvn.log
- result=$?
- if [ $result -ne 0 ]; then
- echo "$log_prefix $TEST_FAILURE: Build failure , please check log: $project_home/mvn.log" | tee -a $testResultFile
- if [ "$SHOW_ERROR_DETAIL" == "1" ]; then
- cat $project_home/mvn.log
- fi
- return 1
- fi
-
- # generate case configuration
- mkdir -p $scenario_home/logs
- scenario_builder_log=$scenario_home/logs/scenario-builder.log
- echo "$log_prefix Generating test case configuration .."
- config_time=$SECONDS
- java -Dconfigure.file=$file \
- -Dscenario.home=$scenario_home \
- -Dscenario.name=$scenario_name \
- -Dscenario.version=$version \
- -Dtest.image.version=$JAVA_VER \
- -Ddebug.service=$DEBUG \
- -jar $test_builder_jar &>$scenario_builder_log
- result=$?
- if [ $result -ne 0 ]; then
- error_msg=$(get_error_msg $scenario_builder_log)
- if [ $result == $EXIT_IGNORED ]; then
- echo "$log_prefix $TEST_IGNORED: $error_msg" | tee -a $testResultFile
- else
- echo "$log_prefix $TEST_FAILURE: Generate case configuration failure: $error_msg, please check log: $scenario_builder_log" | tee -a $testResultFile
- fi
- return $result
- fi
-
- # run test
- echo "$log_prefix Running test case .."
- running_time=$SECONDS
- bash $scenario_home/scenario.sh
- result=$?
- end_time=$SECONDS
-
- if [ $result == 0 ]; then
- echo "$log_prefix $TEST_SUCCESS , cost $((end_time - start_time)) s"
- else
- scenario_log=$scenario_home/logs/scenario.log
- error_msg=$(get_error_msg $scenario_log)
- if [ $result == $EXIT_IGNORED ]; then
- if [ "$error_msg" != "" ]; then
- echo "$log_prefix $TEST_IGNORED: $error_msg, " | tee -a $testResultFile
- else
- echo "$log_prefix $TEST_IGNORED, please check logs: $scenario_home/logs" | tee -a $testResultFile
- fi
- else
- if [ "$error_msg" != "" ]; then
- echo "$log_prefix $TEST_FAILURE: $error_msg, please check logs: $scenario_home/logs" | tee -a $testResultFile
- else
- echo "$log_prefix $TEST_FAILURE, please check logs: $scenario_home/logs" | tee -a $testResultFile
- fi
- fi
-
- # show test log
- if [ "$SHOW_ERROR_DETAIL" == "1" ]; then
- for log_file in $scenario_home/logs/*.log; do
- # ignore scenario-builder.log
- if [[ $log_file != *scenario-builder.log ]]; then
- print_log_file $scenario_name $log_file
- fi
- done
- fi
- return 1
- fi
-
- log_prefix="[${case_no}/${totalCount}] [$scenario_name]"
- echo "$log_prefix $TEST_SUCCESS, total cost $((end_time - case_start_time)) s" | tee -a $testResultFile
-
- # clean log files
- rm -f $project_home/*.log
-}
-
-#-----------------------------------#
-# main
-#-----------------------------------#
-#TEST_CASE_FILE
-if [ "$TEST_CASE_FILE" != "" ]; then
- # convert relative path to absolute path
- if [[ $TEST_CASE_FILE != /* ]]; then
- TEST_CASE_FILE=$(abspath $TEST_CASE_FILE)
- fi
- echo "TEST_CASE_FILE: $TEST_CASE_FILE"
-fi
-
-echo "Test logs dir: \${project.basedir}/target/logs"
-echo "Test reports dir: \${project.basedir}/target/test-reports"
-
-# prepare testcases
-mkdir -p $TEST_DIR/jobs
-testListFile=$TEST_DIR/jobs/testjob.txt
-targetTestcases=$1
-if [ "$targetTestcases" != "" ]; then
- targetTestcases=$(abspath $targetTestcases)
- if [ -d "$targetTestcases" ] || [ -f "$targetTestcases" ]; then
- echo "Target testcase: $targetTestcases"
- echo $targetTestcases >$testListFile
- else
- echo "Testcase not exist: $targetTestcases"
- exit 1
- fi
-else
- # use input testcases file
- if [ "$TEST_CASE_FILE" != "" ]; then
- testListFile=$TEST_CASE_FILE
- if [ ! -f $testListFile ]; then
- echo "Testcases file not found: $testListFile"
- exit 1
- fi
- else
- # find all case-configuration.yml
- base_dir="$(dirname $TEST_DIR)"/test/scenarios
- rm -f $testListFile
- echo "Searching all '$CONFIG_FILE' under dir $base_dir .."
- find $base_dir -name $CONFIG_FILE >$testListFile
- fi
-fi
-
-totalCount=$(grep "" -c $testListFile)
-echo "Total test cases : $totalCount"
-
-if [ "$DEBUG" != "" ] && [ $totalCount -gt 1 ]; then
- echo "Only one case can be debugged"
- exit 1
-fi
-
-#clear test results
-testResultFile=${testListFile%.*}-result-java${JAVA_VER}.txt
-rm -f $testResultFile
-touch $testResultFile
-echo "Test results: $testResultFile"
-
-# build scenario-builder
-SCENARIO_BUILDER_DIR=$TEST_DIR/dubbo-scenario-builder
-echo "Building scenario builder .."
-cd $SCENARIO_BUILDER_DIR
-mvn $BUILD_OPTS &>$SCENARIO_BUILDER_DIR/mvn.log
-result=$?
-cd $WORK_DIR
-if [ $result -ne 0 ]; then
- echo "Build dubbo-scenario-builder failure, please check logs: $SCENARIO_BUILDER_DIR/mvn.log"
- cat $SCENARIO_BUILDER_DIR/mvn.log
- exit $result
-fi
-
-# find jar
-test_builder_jar=$(ls $SCENARIO_BUILDER_DIR/target/dubbo-scenario-builder*-with-dependencies.jar)
-if [ "$test_builder_jar" == "" ]; then
- echo "dubbo-scenario-builder jar not found"
- exit 1
-else
- echo "Found test builder : $test_builder_jar"
-fi
-
-#check test image
-check_test_image
-
-# start run tests
-testStartTime=$SECONDS
-
-#counter
-allTest=0
-finishedTest=0
-
-while read path; do
- allTest=$((allTest + 1))
-
- if [ -f $path ]; then
- path=$(dirname $path)
- fi
- # fork process testcase
- process_case $path $allTest &
- sleep 1
-
- #wait for tests finished
- delta=$maxForks
- if [ $allTest == $totalCount ]; then
- delta=0
- fi
- while [ $finishedTest -lt $totalCount ] && [ $((allTest - finishedTest)) -ge $delta ]; do
- sleep 1
- if [ -f $testResultFile ]; then
- finishedTest=$(grep "" -c $testResultFile)
- if [ "$finishedTest" == "" ]; then
- finishedTest=0
- continue
- fi
- # check fail fast
- if [ "$FAIL_FAST" == "1" ]; then
- failedTest=$(grep "$TEST_FAILURE" -c $testResultFile)
- if [ $failedTest -ne 0 ]; then
- echo "Aborting, wait for subprocess finished .."
- wait
- echo "----------------------------------------------------------"
- echo "Test is aborted cause some testcase is failed (fail-fast mode). "
- echo "Fail tests:"
- grep "$TEST_FAILURE" $testResultFile
- echo "----------------------------------------------------------"
- exit 1
- fi
- fi
- fi
- done
-
-done <$testListFile
-
-successTest=$(grep "$TEST_SUCCESS" -c $testResultFile)
-failedTest=$(grep "$TEST_FAILURE" -c $testResultFile)
-ignoredTest=$(grep "$TEST_IGNORED" -c $testResultFile)
-
-echo "----------------------------------------------------------"
-echo "Test logs dir: \${project.basedir}/target/logs"
-echo "Test reports dir: \${project.basedir}/target/test-reports"
-echo "Test results: $testResultFile"
-echo "Total cost: $((SECONDS - testStartTime)) seconds"
-echo "All tests count: $totalCount"
-echo "Success tests count: $successTest"
-echo "Ignored tests count: $ignoredTest"
-echo "Failed tests count: $failedTest"
-echo "----------------------------------------------------------"
-
-if [ $ignoredTest -gt 0 ]; then
- echo "Ignored tests: $ignoredTest"
- grep "$TEST_IGNORED" $testResultFile
- echo "----------------------------------------------------------"
-fi
-
-if [ $failedTest -gt 0 ]; then
- echo "Failed tests: $failedTest"
- grep "$TEST_FAILURE" $testResultFile
- echo "----------------------------------------------------------"
-fi
-
-echo "Total: $totalCount, Success: $successTest, Failures: $failedTest, Ignored: $ignoredTest"
-
-if [[ $successTest -gt 0 && $(($successTest + $ignoredTest)) == $totalCount ]]; then
- test_result=0
- echo "All tests pass"
-else
- test_result=1
- if [[ $failedTest -gt 0 ]]; then
- echo "Some tests failed: $failedTest"
- elif [ $successTest -eq 0 ]; then
- echo "No test pass"
- else
- echo "Test not completed"
- fi
-fi
-exit $test_result
diff --git a/test/scenarios/pom.xml b/test/scenarios/pom.xml
deleted file mode 100644
index e50413dd..00000000
--- a/test/scenarios/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!--
- 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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-extensions-test</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>dubbo-scenarios</artifactId>
- <packaging>pom</packaging>
- <version>${revision}</version>
-
- <modules>
- <module>scenarios-dubbo-serialization</module>
- </modules>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- </properties>
-
-</project>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/case-configuration.yml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/case-configuration.yml
deleted file mode 100644
index 22050c4e..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/case-configuration.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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: app-builtin-zookeeper.yml
-
-props:
- project_name: dubbo-serialization-avro-test
- main_class: org.apache.dubbo.test.serialization.avro.AvroProvider
- zookeeper_port: 2181
- dubbo_port: 20880
-
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/pom.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/pom.xml
deleted file mode 100644
index 8a74377a..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/pom.xml
+++ /dev/null
@@ -1,157 +0,0 @@
-<!--
- 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>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>scenarios-dubbo-serialization</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>dubbo-serialization-avro-test</artifactId>
-
- <properties>
- <source.level>1.8</source.level>
- <target.level>1.8</target.level>
- <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-bom</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-avro</artifactId>
- <version>${revision}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-testcase</artifactId>
- <version>${revision}</version>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <!-- For jdk 11 above JavaEE annotation -->
- <profile>
- <id>javax.annotation</id>
- <activation>
- <jdk>[1.11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
- <configuration>
- <source>${source.level}</source>
- <target>${target.level}</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.2.0</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>
- ${project.build.directory}/lib
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/java/org/apache/dubbo/test/serialization/avro/AvroProvider.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/java/org/apache/dubbo/test/serialization/avro/AvroProvider.java
deleted file mode 100644
index cd8f9ec1..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/java/org/apache/dubbo/test/serialization/avro/AvroProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.avro;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.concurrent.CountDownLatch;
-
-public class AvroProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- // wait for embedded zookeeper start completely.
- Thread.sleep(1000);
-
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/java/org/apache/dubbo/test/serialization/avro/EmbeddedZooKeeper.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/java/org/apache/dubbo/test/serialization/avro/EmbeddedZooKeeper.java
deleted file mode 100644
index c1a87fdd..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/java/org/apache/dubbo/test/serialization/avro/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright 2014 the original author or authors.
- *
- * Licensed 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.dubbo.test.serialization.avro;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-import org.springframework.util.SocketUtils;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- * <p>
- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
- * <p>
- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
- /**
- * Logger.
- */
- private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
- /**
- * ZooKeeper client port. This will be determined dynamically upon startup.
- */
- private final int clientPort;
-
- /**
- * Whether to auto-start. Default is true.
- */
- private boolean autoStartup = true;
-
- /**
- * Lifecycle phase. Default is 0.
- */
- private int phase = 0;
-
- /**
- * Thread for running the ZooKeeper server.
- */
- private volatile Thread zkServerThread;
-
- /**
- * ZooKeeper server.
- */
- private volatile ZooKeeperServerMain zkServer;
-
- /**
- * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
- */
- private ErrorHandler errorHandler;
-
- private boolean daemon = true;
-
- /**
- * Construct an EmbeddedZooKeeper with a random port.
- */
- public EmbeddedZooKeeper() {
- clientPort = SocketUtils.findAvailableTcpPort();
- }
-
- /**
- * Construct an EmbeddedZooKeeper with the provided port.
- *
- * @param clientPort port for ZooKeeper server to bind to
- */
- public EmbeddedZooKeeper(int clientPort, boolean daemon) {
- this.clientPort = clientPort;
- this.daemon = daemon;
- }
-
- /**
- * Returns the port that clients should use to connect to this embedded server.
- *
- * @return dynamically determined client port
- */
- public int getClientPort() {
- return this.clientPort;
- }
-
- /**
- * Specify whether to start automatically. Default is true.
- *
- * @param autoStartup whether to start automatically
- */
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- /**
- * Specify the lifecycle phase for the embedded server.
- *
- * @param phase the lifecycle phase
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRunning() {
- return (zkServerThread != null);
- }
-
- /**
- * Start the ZooKeeper server in a background thread.
- * <p>
- * Register an error handler via {@link #setErrorHandler} in order to handle
- * any exceptions thrown during startup or execution.
- */
- @Override
- public synchronized void start() {
- if (zkServerThread == null) {
- zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
- zkServerThread.setDaemon(daemon);
- zkServerThread.start();
- }
- }
-
- /**
- * Shutdown the ZooKeeper server.
- */
- @Override
- public synchronized void stop() {
- if (zkServerThread != null) {
- // The shutdown method is protected...thus this hack to invoke it.
- // This will log an exception on shutdown; see
- // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
- try {
- Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
- shutdown.setAccessible(true);
- shutdown.invoke(zkServer);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- // It is expected that the thread will exit after
- // the server is shutdown; this will block until
- // the shutdown is complete.
- try {
- zkServerThread.join(5000);
- zkServerThread = null;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
- // abandoning zk thread
- zkServerThread = null;
- }
- }
- }
-
- /**
- * Stop the server if running and invoke the callback when complete.
- */
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- /**
- * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
- * is provided, only error-level logging will occur.
- *
- * @param errorHandler the {@link ErrorHandler} to be invoked
- */
- public void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Runnable implementation that starts the ZooKeeper server.
- */
- private class ServerRunnable implements Runnable {
-
- @Override
- public void run() {
- try {
- Properties properties = new Properties();
- File file = new File(System.getProperty("java.io.tmpdir")
- + File.separator + UUID.randomUUID());
- file.deleteOnExit();
- properties.setProperty("dataDir", file.getAbsolutePath());
- properties.setProperty("clientPort", String.valueOf(clientPort));
-
- QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
- quorumPeerConfig.parseProperties(properties);
-
- zkServer = new ZooKeeperServerMain();
- ServerConfig configuration = new ServerConfig();
- configuration.readFrom(quorumPeerConfig);
-
- zkServer.runFromConfig(configuration);
- } catch (Exception e) {
- if (errorHandler != null) {
- errorHandler.handleError(e);
- } else {
- logger.error("Exception running embedded ZooKeeper", e);
- }
- }
- }
- }
-
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/log4j.properties b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/log4j.properties
deleted file mode 100644
index 1f8fe1ec..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-###set log levels###
-log4j.rootLogger=info, stdout
-###output to the console###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/spring/dubbo-demo-consumer.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index 76d0a501..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-avro-consumer"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <dubbo:reference id="demoService" check="true"
- interface="org.apache.dubbo.test.serialization.testcase.DemoService"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/spring/dubbo-demo-provider.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/spring/dubbo-demo-provider.xml
deleted file mode 100644
index 9fef92c3..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/main/resources/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-avro-provider"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <bean id="demoService" class="org.apache.dubbo.test.serialization.testcase.DemoServiceImpl"/>
-
- <dubbo:service interface="org.apache.dubbo.test.serialization.testcase.DemoService" ref="demoService"
- serialization="avro"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/test/java/DemoServiceIT.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/test/java/DemoServiceIT.java
deleted file mode 100644
index 437d019c..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-avro-test/src/test/java/DemoServiceIT.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-import org.apache.dubbo.test.serialization.testcase.BigPerson;
-import org.apache.dubbo.test.serialization.testcase.DemoService;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.Random;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath*:spring/dubbo-demo-consumer.xml")
-public class DemoServiceIT {
- @Autowired
- @Qualifier("demoService")
- private DemoService service;
-
-
- @Test
- public void testVoid() throws Exception {
- service.testVoid();
- }
-
- @Test
- public void testString() throws Exception {
- Assert.assertTrue(service.testString("world").endsWith("world"));
- }
-
- @Test
- public void testBase() throws Exception {
- Random random = new Random(10000);
- int num = random.nextInt();
- Assert.assertEquals(100 + num, service.testBase(num));
- }
-
- @Test
- public void testObject() throws Exception {
- BigPerson person = BigPerson.build();
- Assert.assertEquals(service.testObject(person), person);
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/case-configuration.yml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/case-configuration.yml
deleted file mode 100644
index 83177b65..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/case-configuration.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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: app-builtin-zookeeper.yml
-
-props:
- project_name: dubbo-serialization-fastjson-test
- main_class: org.apache.dubbo.test.serialization.fastjson.FastjsonProvider
- zookeeper_port: 2181
- dubbo_port: 20880
-
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/pom.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/pom.xml
deleted file mode 100644
index 3444299a..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/pom.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<!--
- 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>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>scenarios-dubbo-serialization</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>dubbo-serialization-fastjson-test</artifactId>
-
- <properties>
- <source.level>1.8</source.level>
- <target.level>1.8</target.level>
- <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- </properties>
-
-
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-fastjson</artifactId>
- <version>${revision}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-testcase</artifactId>
- <version>${revision}</version>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <!-- For jdk 11 above JavaEE annotation -->
- <profile>
- <id>javax.annotation</id>
- <activation>
- <jdk>[1.11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
- <configuration>
- <source>${source.level}</source>
- <target>${target.level}</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.2.0</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>
- ${project.build.directory}/lib
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/java/org/apache/dubbo/test/serialization/fastjson/EmbeddedZooKeeper.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/java/org/apache/dubbo/test/serialization/fastjson/EmbeddedZooKeeper.java
deleted file mode 100644
index a286ec4b..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/java/org/apache/dubbo/test/serialization/fastjson/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright 2014 the original author or authors.
- *
- * Licensed 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.dubbo.test.serialization.fastjson;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-import org.springframework.util.SocketUtils;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- * <p>
- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
- * <p>
- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
- /**
- * Logger.
- */
- private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
- /**
- * ZooKeeper client port. This will be determined dynamically upon startup.
- */
- private final int clientPort;
-
- /**
- * Whether to auto-start. Default is true.
- */
- private boolean autoStartup = true;
-
- /**
- * Lifecycle phase. Default is 0.
- */
- private int phase = 0;
-
- /**
- * Thread for running the ZooKeeper server.
- */
- private volatile Thread zkServerThread;
-
- /**
- * ZooKeeper server.
- */
- private volatile ZooKeeperServerMain zkServer;
-
- /**
- * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
- */
- private ErrorHandler errorHandler;
-
- private boolean daemon = true;
-
- /**
- * Construct an EmbeddedZooKeeper with a random port.
- */
- public EmbeddedZooKeeper() {
- clientPort = SocketUtils.findAvailableTcpPort();
- }
-
- /**
- * Construct an EmbeddedZooKeeper with the provided port.
- *
- * @param clientPort port for ZooKeeper server to bind to
- */
- public EmbeddedZooKeeper(int clientPort, boolean daemon) {
- this.clientPort = clientPort;
- this.daemon = daemon;
- }
-
- /**
- * Returns the port that clients should use to connect to this embedded server.
- *
- * @return dynamically determined client port
- */
- public int getClientPort() {
- return this.clientPort;
- }
-
- /**
- * Specify whether to start automatically. Default is true.
- *
- * @param autoStartup whether to start automatically
- */
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- /**
- * Specify the lifecycle phase for the embedded server.
- *
- * @param phase the lifecycle phase
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRunning() {
- return (zkServerThread != null);
- }
-
- /**
- * Start the ZooKeeper server in a background thread.
- * <p>
- * Register an error handler via {@link #setErrorHandler} in order to handle
- * any exceptions thrown during startup or execution.
- */
- @Override
- public synchronized void start() {
- if (zkServerThread == null) {
- zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
- zkServerThread.setDaemon(daemon);
- zkServerThread.start();
- }
- }
-
- /**
- * Shutdown the ZooKeeper server.
- */
- @Override
- public synchronized void stop() {
- if (zkServerThread != null) {
- // The shutdown method is protected...thus this hack to invoke it.
- // This will log an exception on shutdown; see
- // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
- try {
- Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
- shutdown.setAccessible(true);
- shutdown.invoke(zkServer);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- // It is expected that the thread will exit after
- // the server is shutdown; this will block until
- // the shutdown is complete.
- try {
- zkServerThread.join(5000);
- zkServerThread = null;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
- // abandoning zk thread
- zkServerThread = null;
- }
- }
- }
-
- /**
- * Stop the server if running and invoke the callback when complete.
- */
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- /**
- * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
- * is provided, only error-level logging will occur.
- *
- * @param errorHandler the {@link ErrorHandler} to be invoked
- */
- public void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Runnable implementation that starts the ZooKeeper server.
- */
- private class ServerRunnable implements Runnable {
-
- @Override
- public void run() {
- try {
- Properties properties = new Properties();
- File file = new File(System.getProperty("java.io.tmpdir")
- + File.separator + UUID.randomUUID());
- file.deleteOnExit();
- properties.setProperty("dataDir", file.getAbsolutePath());
- properties.setProperty("clientPort", String.valueOf(clientPort));
-
- QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
- quorumPeerConfig.parseProperties(properties);
-
- zkServer = new ZooKeeperServerMain();
- ServerConfig configuration = new ServerConfig();
- configuration.readFrom(quorumPeerConfig);
-
- zkServer.runFromConfig(configuration);
- } catch (Exception e) {
- if (errorHandler != null) {
- errorHandler.handleError(e);
- } else {
- logger.error("Exception running embedded ZooKeeper", e);
- }
- }
- }
- }
-
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/java/org/apache/dubbo/test/serialization/fastjson/FastjsonProvider.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/java/org/apache/dubbo/test/serialization/fastjson/FastjsonProvider.java
deleted file mode 100644
index 7a18bcb0..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/java/org/apache/dubbo/test/serialization/fastjson/FastjsonProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.fastjson;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.concurrent.CountDownLatch;
-
-public class FastjsonProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- // wait for embedded zookeeper start completely.
- Thread.sleep(1000);
-
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/log4j.properties b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/log4j.properties
deleted file mode 100644
index 1f8fe1ec..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-###set log levels###
-log4j.rootLogger=info, stdout
-###output to the console###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/spring/dubbo-demo-consumer.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index 60aad240..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-fastjson-consumer"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <dubbo:reference id="demoService" check="true"
- interface="org.apache.dubbo.test.serialization.testcase.DemoService"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/spring/dubbo-demo-provider.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/spring/dubbo-demo-provider.xml
deleted file mode 100644
index 69f149e6..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/main/resources/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-fastjson-provider"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <bean id="demoService" class="org.apache.dubbo.test.serialization.testcase.DemoServiceImpl"/>
-
- <dubbo:service interface="org.apache.dubbo.test.serialization.testcase.DemoService" ref="demoService"
- serialization="fastjson"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/test/java/DemoServiceIT.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/test/java/DemoServiceIT.java
deleted file mode 100644
index 437d019c..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fastjson-test/src/test/java/DemoServiceIT.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-import org.apache.dubbo.test.serialization.testcase.BigPerson;
-import org.apache.dubbo.test.serialization.testcase.DemoService;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.Random;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath*:spring/dubbo-demo-consumer.xml")
-public class DemoServiceIT {
- @Autowired
- @Qualifier("demoService")
- private DemoService service;
-
-
- @Test
- public void testVoid() throws Exception {
- service.testVoid();
- }
-
- @Test
- public void testString() throws Exception {
- Assert.assertTrue(service.testString("world").endsWith("world"));
- }
-
- @Test
- public void testBase() throws Exception {
- Random random = new Random(10000);
- int num = random.nextInt();
- Assert.assertEquals(100 + num, service.testBase(num));
- }
-
- @Test
- public void testObject() throws Exception {
- BigPerson person = BigPerson.build();
- Assert.assertEquals(service.testObject(person), person);
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/case-configuration.yml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/case-configuration.yml
deleted file mode 100644
index 7eb52dfc..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/case-configuration.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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: app-builtin-zookeeper.yml
-
-props:
- project_name: dubbo-serialization-fst-test
- main_class: org.apache.dubbo.test.serialization.fst.FstProvider
- zookeeper_port: 2181
- dubbo_port: 20880
-
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/pom.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/pom.xml
deleted file mode 100644
index 6e6a6d5e..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/pom.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-<!--
- 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>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>scenarios-dubbo-serialization</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>dubbo-serialization-fst-test</artifactId>
-
- <properties>
- <source.level>1.8</source.level>
- <target.level>1.8</target.level>
- <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-bom</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-fst</artifactId>
- <version>${revision}</version>
- <exclusions>
- <exclusion>
- <artifactId>jackson-core</artifactId>
- <groupId>com.fasterxml.jackson.core</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-testcase</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <!-- For jdk 11 above JavaEE annotation -->
- <profile>
- <id>javax.annotation</id>
- <activation>
- <jdk>[1.11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
- <configuration>
- <source>${source.level}</source>
- <target>${target.level}</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.2.0</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>
- ${project.build.directory}/lib
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/java/org/apache/dubbo/test/serialization/fst/EmbeddedZooKeeper.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/java/org/apache/dubbo/test/serialization/fst/EmbeddedZooKeeper.java
deleted file mode 100644
index f25a81de..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/java/org/apache/dubbo/test/serialization/fst/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright 2014 the original author or authors.
- *
- * Licensed 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.dubbo.test.serialization.fst;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-import org.springframework.util.SocketUtils;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- * <p>
- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
- * <p>
- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
- /**
- * Logger.
- */
- private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
- /**
- * ZooKeeper client port. This will be determined dynamically upon startup.
- */
- private final int clientPort;
-
- /**
- * Whether to auto-start. Default is true.
- */
- private boolean autoStartup = true;
-
- /**
- * Lifecycle phase. Default is 0.
- */
- private int phase = 0;
-
- /**
- * Thread for running the ZooKeeper server.
- */
- private volatile Thread zkServerThread;
-
- /**
- * ZooKeeper server.
- */
- private volatile ZooKeeperServerMain zkServer;
-
- /**
- * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
- */
- private ErrorHandler errorHandler;
-
- private boolean daemon = true;
-
- /**
- * Construct an EmbeddedZooKeeper with a random port.
- */
- public EmbeddedZooKeeper() {
- clientPort = SocketUtils.findAvailableTcpPort();
- }
-
- /**
- * Construct an EmbeddedZooKeeper with the provided port.
- *
- * @param clientPort port for ZooKeeper server to bind to
- */
- public EmbeddedZooKeeper(int clientPort, boolean daemon) {
- this.clientPort = clientPort;
- this.daemon = daemon;
- }
-
- /**
- * Returns the port that clients should use to connect to this embedded server.
- *
- * @return dynamically determined client port
- */
- public int getClientPort() {
- return this.clientPort;
- }
-
- /**
- * Specify whether to start automatically. Default is true.
- *
- * @param autoStartup whether to start automatically
- */
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- /**
- * Specify the lifecycle phase for the embedded server.
- *
- * @param phase the lifecycle phase
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRunning() {
- return (zkServerThread != null);
- }
-
- /**
- * Start the ZooKeeper server in a background thread.
- * <p>
- * Register an error handler via {@link #setErrorHandler} in order to handle
- * any exceptions thrown during startup or execution.
- */
- @Override
- public synchronized void start() {
- if (zkServerThread == null) {
- zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
- zkServerThread.setDaemon(daemon);
- zkServerThread.start();
- }
- }
-
- /**
- * Shutdown the ZooKeeper server.
- */
- @Override
- public synchronized void stop() {
- if (zkServerThread != null) {
- // The shutdown method is protected...thus this hack to invoke it.
- // This will log an exception on shutdown; see
- // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
- try {
- Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
- shutdown.setAccessible(true);
- shutdown.invoke(zkServer);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- // It is expected that the thread will exit after
- // the server is shutdown; this will block until
- // the shutdown is complete.
- try {
- zkServerThread.join(5000);
- zkServerThread = null;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
- // abandoning zk thread
- zkServerThread = null;
- }
- }
- }
-
- /**
- * Stop the server if running and invoke the callback when complete.
- */
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- /**
- * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
- * is provided, only error-level logging will occur.
- *
- * @param errorHandler the {@link ErrorHandler} to be invoked
- */
- public void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Runnable implementation that starts the ZooKeeper server.
- */
- private class ServerRunnable implements Runnable {
-
- @Override
- public void run() {
- try {
- Properties properties = new Properties();
- File file = new File(System.getProperty("java.io.tmpdir")
- + File.separator + UUID.randomUUID());
- file.deleteOnExit();
- properties.setProperty("dataDir", file.getAbsolutePath());
- properties.setProperty("clientPort", String.valueOf(clientPort));
-
- QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
- quorumPeerConfig.parseProperties(properties);
-
- zkServer = new ZooKeeperServerMain();
- ServerConfig configuration = new ServerConfig();
- configuration.readFrom(quorumPeerConfig);
-
- zkServer.runFromConfig(configuration);
- } catch (Exception e) {
- if (errorHandler != null) {
- errorHandler.handleError(e);
- } else {
- logger.error("Exception running embedded ZooKeeper", e);
- }
- }
- }
- }
-
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/java/org/apache/dubbo/test/serialization/fst/FstProvider.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/java/org/apache/dubbo/test/serialization/fst/FstProvider.java
deleted file mode 100644
index ff816734..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/java/org/apache/dubbo/test/serialization/fst/FstProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.fst;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.concurrent.CountDownLatch;
-
-public class FstProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- // wait for embedded zookeeper start completely.
- Thread.sleep(1000);
-
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/log4j.properties b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/log4j.properties
deleted file mode 100644
index 1f8fe1ec..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-###set log levels###
-log4j.rootLogger=info, stdout
-###output to the console###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/spring/dubbo-demo-consumer.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index 0617e3e3..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-fst-consumer"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <dubbo:reference id="demoService" check="true"
- interface="org.apache.dubbo.test.serialization.testcase.DemoService"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/spring/dubbo-demo-provider.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/spring/dubbo-demo-provider.xml
deleted file mode 100644
index edd6c1bd..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/main/resources/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-fst-provider"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <bean id="demoService" class="org.apache.dubbo.test.serialization.testcase.DemoServiceImpl"/>
-
- <dubbo:service interface="org.apache.dubbo.test.serialization.testcase.DemoService" ref="demoService"
- serialization="fst"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/test/java/DemoServiceIT.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/test/java/DemoServiceIT.java
deleted file mode 100644
index 437d019c..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-fst-test/src/test/java/DemoServiceIT.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-import org.apache.dubbo.test.serialization.testcase.BigPerson;
-import org.apache.dubbo.test.serialization.testcase.DemoService;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.Random;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath*:spring/dubbo-demo-consumer.xml")
-public class DemoServiceIT {
- @Autowired
- @Qualifier("demoService")
- private DemoService service;
-
-
- @Test
- public void testVoid() throws Exception {
- service.testVoid();
- }
-
- @Test
- public void testString() throws Exception {
- Assert.assertTrue(service.testString("world").endsWith("world"));
- }
-
- @Test
- public void testBase() throws Exception {
- Random random = new Random(10000);
- int num = random.nextInt();
- Assert.assertEquals(100 + num, service.testBase(num));
- }
-
- @Test
- public void testObject() throws Exception {
- BigPerson person = BigPerson.build();
- Assert.assertEquals(service.testObject(person), person);
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/case-configuration.yml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/case-configuration.yml
deleted file mode 100644
index b4207b3d..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/case-configuration.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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: app-builtin-zookeeper.yml
-
-props:
- project_name: dubbo-serialization-gson-test
- main_class: org.apache.dubbo.test.serialization.gson.GsonProvider
- zookeeper_port: 2181
- dubbo_port: 20880
-
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/pom.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/pom.xml
deleted file mode 100644
index c5e16157..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/pom.xml
+++ /dev/null
@@ -1,159 +0,0 @@
-<!--
- 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>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>scenarios-dubbo-serialization</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>dubbo-serialization-gson-test</artifactId>
-
- <properties>
- <source.level>1.8</source.level>
- <target.level>1.8</target.level>
- <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-bom</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-gson</artifactId>
- <version>${revision}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-testcase</artifactId>
- <version>${revision}</version>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <!-- For jdk 11 above JavaEE annotation -->
- <profile>
- <id>javax.annotation</id>
- <activation>
- <jdk>[1.11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
- </dependencies>
- </profile>
-
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
- <configuration>
- <source>${source.level}</source>
- <target>${target.level}</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.2.0</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>
- ${project.build.directory}/lib
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/java/org/apache/dubbo/test/serialization/gson/EmbeddedZooKeeper.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/java/org/apache/dubbo/test/serialization/gson/EmbeddedZooKeeper.java
deleted file mode 100644
index 26cd9894..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/java/org/apache/dubbo/test/serialization/gson/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright 2014 the original author or authors.
- *
- * Licensed 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.dubbo.test.serialization.gson;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-import org.springframework.util.SocketUtils;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- * <p>
- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
- * <p>
- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
- /**
- * Logger.
- */
- private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
- /**
- * ZooKeeper client port. This will be determined dynamically upon startup.
- */
- private final int clientPort;
-
- /**
- * Whether to auto-start. Default is true.
- */
- private boolean autoStartup = true;
-
- /**
- * Lifecycle phase. Default is 0.
- */
- private int phase = 0;
-
- /**
- * Thread for running the ZooKeeper server.
- */
- private volatile Thread zkServerThread;
-
- /**
- * ZooKeeper server.
- */
- private volatile ZooKeeperServerMain zkServer;
-
- /**
- * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
- */
- private ErrorHandler errorHandler;
-
- private boolean daemon = true;
-
- /**
- * Construct an EmbeddedZooKeeper with a random port.
- */
- public EmbeddedZooKeeper() {
- clientPort = SocketUtils.findAvailableTcpPort();
- }
-
- /**
- * Construct an EmbeddedZooKeeper with the provided port.
- *
- * @param clientPort port for ZooKeeper server to bind to
- */
- public EmbeddedZooKeeper(int clientPort, boolean daemon) {
- this.clientPort = clientPort;
- this.daemon = daemon;
- }
-
- /**
- * Returns the port that clients should use to connect to this embedded server.
- *
- * @return dynamically determined client port
- */
- public int getClientPort() {
- return this.clientPort;
- }
-
- /**
- * Specify whether to start automatically. Default is true.
- *
- * @param autoStartup whether to start automatically
- */
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- /**
- * Specify the lifecycle phase for the embedded server.
- *
- * @param phase the lifecycle phase
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRunning() {
- return (zkServerThread != null);
- }
-
- /**
- * Start the ZooKeeper server in a background thread.
- * <p>
- * Register an error handler via {@link #setErrorHandler} in order to handle
- * any exceptions thrown during startup or execution.
- */
- @Override
- public synchronized void start() {
- if (zkServerThread == null) {
- zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
- zkServerThread.setDaemon(daemon);
- zkServerThread.start();
- }
- }
-
- /**
- * Shutdown the ZooKeeper server.
- */
- @Override
- public synchronized void stop() {
- if (zkServerThread != null) {
- // The shutdown method is protected...thus this hack to invoke it.
- // This will log an exception on shutdown; see
- // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
- try {
- Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
- shutdown.setAccessible(true);
- shutdown.invoke(zkServer);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- // It is expected that the thread will exit after
- // the server is shutdown; this will block until
- // the shutdown is complete.
- try {
- zkServerThread.join(5000);
- zkServerThread = null;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
- // abandoning zk thread
- zkServerThread = null;
- }
- }
- }
-
- /**
- * Stop the server if running and invoke the callback when complete.
- */
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- /**
- * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
- * is provided, only error-level logging will occur.
- *
- * @param errorHandler the {@link ErrorHandler} to be invoked
- */
- public void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Runnable implementation that starts the ZooKeeper server.
- */
- private class ServerRunnable implements Runnable {
-
- @Override
- public void run() {
- try {
- Properties properties = new Properties();
- File file = new File(System.getProperty("java.io.tmpdir")
- + File.separator + UUID.randomUUID());
- file.deleteOnExit();
- properties.setProperty("dataDir", file.getAbsolutePath());
- properties.setProperty("clientPort", String.valueOf(clientPort));
-
- QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
- quorumPeerConfig.parseProperties(properties);
-
- zkServer = new ZooKeeperServerMain();
- ServerConfig configuration = new ServerConfig();
- configuration.readFrom(quorumPeerConfig);
-
- zkServer.runFromConfig(configuration);
- } catch (Exception e) {
- if (errorHandler != null) {
- errorHandler.handleError(e);
- } else {
- logger.error("Exception running embedded ZooKeeper", e);
- }
- }
- }
- }
-
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/java/org/apache/dubbo/test/serialization/gson/GsonProvider.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/java/org/apache/dubbo/test/serialization/gson/GsonProvider.java
deleted file mode 100644
index 4d26746e..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/java/org/apache/dubbo/test/serialization/gson/GsonProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.gson;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.concurrent.CountDownLatch;
-
-public class GsonProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- // wait for embedded zookeeper start completely.
- Thread.sleep(1000);
-
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/log4j.properties b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/log4j.properties
deleted file mode 100644
index 1f8fe1ec..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-###set log levels###
-log4j.rootLogger=info, stdout
-###output to the console###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/spring/dubbo-demo-consumer.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index 1626ced6..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-gson-consumer"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <dubbo:reference id="demoService" check="true"
- interface="org.apache.dubbo.test.serialization.testcase.DemoService"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/spring/dubbo-demo-provider.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/spring/dubbo-demo-provider.xml
deleted file mode 100644
index 9ebd8341..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/main/resources/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-gson-provider"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <bean id="demoService" class="org.apache.dubbo.test.serialization.testcase.DemoServiceImpl"/>
-
- <dubbo:service interface="org.apache.dubbo.test.serialization.testcase.DemoService" ref="demoService"
- serialization="gson"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/test/java/DemoServiceIT.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/test/java/DemoServiceIT.java
deleted file mode 100644
index 437d019c..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-gson-test/src/test/java/DemoServiceIT.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-import org.apache.dubbo.test.serialization.testcase.BigPerson;
-import org.apache.dubbo.test.serialization.testcase.DemoService;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.Random;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath*:spring/dubbo-demo-consumer.xml")
-public class DemoServiceIT {
- @Autowired
- @Qualifier("demoService")
- private DemoService service;
-
-
- @Test
- public void testVoid() throws Exception {
- service.testVoid();
- }
-
- @Test
- public void testString() throws Exception {
- Assert.assertTrue(service.testString("world").endsWith("world"));
- }
-
- @Test
- public void testBase() throws Exception {
- Random random = new Random(10000);
- int num = random.nextInt();
- Assert.assertEquals(100 + num, service.testBase(num));
- }
-
- @Test
- public void testObject() throws Exception {
- BigPerson person = BigPerson.build();
- Assert.assertEquals(service.testObject(person), person);
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/case-configuration.yml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/case-configuration.yml
deleted file mode 100644
index 4a4316cf..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/case-configuration.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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: app-builtin-zookeeper.yml
-
-props:
- project_name: dubbo-serialization-kryo-test
- main_class: org.apache.dubbo.test.serialization.kryo.KryoProvider
- zookeeper_port: 2181
- dubbo_port: 20880
-
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/pom.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/pom.xml
deleted file mode 100644
index 19e6c5de..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/pom.xml
+++ /dev/null
@@ -1,157 +0,0 @@
-<!--
- 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>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>scenarios-dubbo-serialization</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>dubbo-serialization-kryo-test</artifactId>
-
- <properties>
- <source.level>1.8</source.level>
- <target.level>1.8</target.level>
- <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-extensions-dependencies-bom</artifactId>
- <version>${revision}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
-
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-kryo</artifactId>
- <version>${revision}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-testcase</artifactId>
- <version>${revision}</version>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <!-- For jdk 11 above JavaEE annotation -->
- <profile>
- <id>javax.annotation</id>
- <activation>
- <jdk>[1.11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
- </dependencies>
- </profile>
-
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
- <configuration>
- <source>${source.level}</source>
- <target>${target.level}</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.2.0</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>
- ${project.build.directory}/lib
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/java/org/apache/dubbo/test/serialization/kryo/EmbeddedZooKeeper.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/java/org/apache/dubbo/test/serialization/kryo/EmbeddedZooKeeper.java
deleted file mode 100644
index 616ba406..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/java/org/apache/dubbo/test/serialization/kryo/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright 2014 the original author or authors.
- *
- * Licensed 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.dubbo.test.serialization.kryo;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-import org.springframework.util.SocketUtils;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- * <p>
- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
- * <p>
- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
- /**
- * Logger.
- */
- private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
- /**
- * ZooKeeper client port. This will be determined dynamically upon startup.
- */
- private final int clientPort;
-
- /**
- * Whether to auto-start. Default is true.
- */
- private boolean autoStartup = true;
-
- /**
- * Lifecycle phase. Default is 0.
- */
- private int phase = 0;
-
- /**
- * Thread for running the ZooKeeper server.
- */
- private volatile Thread zkServerThread;
-
- /**
- * ZooKeeper server.
- */
- private volatile ZooKeeperServerMain zkServer;
-
- /**
- * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
- */
- private ErrorHandler errorHandler;
-
- private boolean daemon = true;
-
- /**
- * Construct an EmbeddedZooKeeper with a random port.
- */
- public EmbeddedZooKeeper() {
- clientPort = SocketUtils.findAvailableTcpPort();
- }
-
- /**
- * Construct an EmbeddedZooKeeper with the provided port.
- *
- * @param clientPort port for ZooKeeper server to bind to
- */
- public EmbeddedZooKeeper(int clientPort, boolean daemon) {
- this.clientPort = clientPort;
- this.daemon = daemon;
- }
-
- /**
- * Returns the port that clients should use to connect to this embedded server.
- *
- * @return dynamically determined client port
- */
- public int getClientPort() {
- return this.clientPort;
- }
-
- /**
- * Specify whether to start automatically. Default is true.
- *
- * @param autoStartup whether to start automatically
- */
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- /**
- * Specify the lifecycle phase for the embedded server.
- *
- * @param phase the lifecycle phase
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRunning() {
- return (zkServerThread != null);
- }
-
- /**
- * Start the ZooKeeper server in a background thread.
- * <p>
- * Register an error handler via {@link #setErrorHandler} in order to handle
- * any exceptions thrown during startup or execution.
- */
- @Override
- public synchronized void start() {
- if (zkServerThread == null) {
- zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
- zkServerThread.setDaemon(daemon);
- zkServerThread.start();
- }
- }
-
- /**
- * Shutdown the ZooKeeper server.
- */
- @Override
- public synchronized void stop() {
- if (zkServerThread != null) {
- // The shutdown method is protected...thus this hack to invoke it.
- // This will log an exception on shutdown; see
- // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
- try {
- Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
- shutdown.setAccessible(true);
- shutdown.invoke(zkServer);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- // It is expected that the thread will exit after
- // the server is shutdown; this will block until
- // the shutdown is complete.
- try {
- zkServerThread.join(5000);
- zkServerThread = null;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
- // abandoning zk thread
- zkServerThread = null;
- }
- }
- }
-
- /**
- * Stop the server if running and invoke the callback when complete.
- */
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- /**
- * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
- * is provided, only error-level logging will occur.
- *
- * @param errorHandler the {@link ErrorHandler} to be invoked
- */
- public void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Runnable implementation that starts the ZooKeeper server.
- */
- private class ServerRunnable implements Runnable {
-
- @Override
- public void run() {
- try {
- Properties properties = new Properties();
- File file = new File(System.getProperty("java.io.tmpdir")
- + File.separator + UUID.randomUUID());
- file.deleteOnExit();
- properties.setProperty("dataDir", file.getAbsolutePath());
- properties.setProperty("clientPort", String.valueOf(clientPort));
-
- QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
- quorumPeerConfig.parseProperties(properties);
-
- zkServer = new ZooKeeperServerMain();
- ServerConfig configuration = new ServerConfig();
- configuration.readFrom(quorumPeerConfig);
-
- zkServer.runFromConfig(configuration);
- } catch (Exception e) {
- if (errorHandler != null) {
- errorHandler.handleError(e);
- } else {
- logger.error("Exception running embedded ZooKeeper", e);
- }
- }
- }
- }
-
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/java/org/apache/dubbo/test/serialization/kryo/KryoProvider.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/java/org/apache/dubbo/test/serialization/kryo/KryoProvider.java
deleted file mode 100644
index 7ac44801..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/java/org/apache/dubbo/test/serialization/kryo/KryoProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.kryo;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.concurrent.CountDownLatch;
-
-public class KryoProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- // wait for embedded zookeeper start completely.
- Thread.sleep(1000);
-
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/log4j.properties b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/log4j.properties
deleted file mode 100644
index 1f8fe1ec..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-###set log levels###
-log4j.rootLogger=info, stdout
-###output to the console###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/spring/dubbo-demo-consumer.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index ef1364c0..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-kryo-consumer"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <dubbo:reference id="demoService" check="true"
- interface="org.apache.dubbo.test.serialization.testcase.DemoService"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/spring/dubbo-demo-provider.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/spring/dubbo-demo-provider.xml
deleted file mode 100644
index a4f03ce0..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/main/resources/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-kryo-provider"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <bean id="demoService" class="org.apache.dubbo.test.serialization.testcase.DemoServiceImpl"/>
-
- <dubbo:service interface="org.apache.dubbo.test.serialization.testcase.DemoService" ref="demoService"
- serialization="kryo"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/test/java/DemoServiceIT.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/test/java/DemoServiceIT.java
deleted file mode 100644
index 437d019c..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-kryo-test/src/test/java/DemoServiceIT.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-import org.apache.dubbo.test.serialization.testcase.BigPerson;
-import org.apache.dubbo.test.serialization.testcase.DemoService;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.Random;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath*:spring/dubbo-demo-consumer.xml")
-public class DemoServiceIT {
- @Autowired
- @Qualifier("demoService")
- private DemoService service;
-
-
- @Test
- public void testVoid() throws Exception {
- service.testVoid();
- }
-
- @Test
- public void testString() throws Exception {
- Assert.assertTrue(service.testString("world").endsWith("world"));
- }
-
- @Test
- public void testBase() throws Exception {
- Random random = new Random(10000);
- int num = random.nextInt();
- Assert.assertEquals(100 + num, service.testBase(num));
- }
-
- @Test
- public void testObject() throws Exception {
- BigPerson person = BigPerson.build();
- Assert.assertEquals(service.testObject(person), person);
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/case-configuration.yml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/case-configuration.yml
deleted file mode 100644
index 61821717..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/case-configuration.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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: app-builtin-zookeeper.yml
-
-props:
- project_name: dubbo-serialization-protobuf-test
- main_class: org.apache.dubbo.test.serialization.protobuf.ProtobufProvider
- zookeeper_port: 2181
- dubbo_port: 20880
-
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/pom.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/pom.xml
deleted file mode 100644
index 768a3621..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/pom.xml
+++ /dev/null
@@ -1,204 +0,0 @@
-<!--
- 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>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>scenarios-dubbo-serialization</artifactId>
- <version>${revision}</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>dubbo-serialization-protobuf-test</artifactId>
-
- <properties>
- <source.level>1.8</source.level>
- <target.level>1.8</target.level>
- <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-bom</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper</artifactId>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.dubbo.extensions</groupId>
- <artifactId>dubbo-serialization-protobuf</artifactId>
- <version>${revision}</version>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <!-- For jdk 11 above JavaEE annotation -->
- <profile>
- <id>javax.annotation</id>
- <activation>
- <jdk>[1.11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
- </dependencies>
- </profile>
-
- </profiles>
-
- <build>
- <extensions>
- <extension>
- <groupId>kr.motd.maven</groupId>
- <artifactId>os-maven-plugin</artifactId>
- <version>1.6.1</version>
- </extension>
- </extensions>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin.version}</version>
- <configuration>
- <source>${source.level}</source>
- <target>${target.level}</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.2.0</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>
- ${project.build.directory}/lib
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.xolstice.maven.plugins</groupId>
- <artifactId>protobuf-maven-plugin</artifactId>
- <version>0.5.1</version>
- <configuration>
- <protocArtifact>com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}</protocArtifact>
- <outputDirectory>build/generated/source/proto/main/java</outputDirectory>
- <clearOutputDirectory>false</clearOutputDirectory>
- <protocPlugins>
- <protocPlugin>
- <id>dubbo-triple</id>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-compiler</artifactId>
- <version>${dubbo.version}</version>
- <mainClass>org.apache.dubbo.gen.tri.Dubbo3TripleGenerator</mainClass>
- </protocPlugin>
- </protocPlugins>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>test-compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>build/generated/source/proto/main/java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/DemoServiceImpl.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/DemoServiceImpl.java
deleted file mode 100644
index 14c2f61a..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/DemoServiceImpl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.protobuf;
-
-import com.google.protobuf.Empty;
-import com.google.protobuf.Int32Value;
-import com.google.protobuf.StringValue;
-
-import java.util.concurrent.CompletableFuture;
-
-public class DemoServiceImpl implements DemoService {
-
- @Override
- public Empty testVoid(Empty request) {
- return Empty.getDefaultInstance();
- }
-
- @Override
- public CompletableFuture<Empty> testVoidAsync(Empty request) {
- return CompletableFuture.completedFuture(testVoid(request));
- }
-
- @Override
- public StringValue testString(StringValue request) {
- return StringValue.of("Hello " + request.getValue());
- }
-
- @Override
- public CompletableFuture<StringValue> testStringAsync(StringValue request) {
- return CompletableFuture.completedFuture(testString(request));
- }
-
- @Override
- public Int32Value testBase(Int32Value request) {
- return Int32Value.of(100 + request.getValue());
- }
-
- @Override
- public CompletableFuture<Int32Value> testBaseAsync(Int32Value request) {
- return CompletableFuture.completedFuture(testBase(request));
- }
-
- @Override
- public BigPerson testObject(BigPerson request) {
- return request;
- }
-
- @Override
- public CompletableFuture<BigPerson> testObjectAsync(BigPerson request) {
- return CompletableFuture.completedFuture(testObject(request));
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/EmbeddedZooKeeper.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/EmbeddedZooKeeper.java
deleted file mode 100644
index 6b72fe86..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.protobuf;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-import org.springframework.util.SocketUtils;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- * <p>
- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
- * <p>
- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
- /**
- * Logger.
- */
- private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
- /**
- * ZooKeeper client port. This will be determined dynamically upon startup.
- */
- private final int clientPort;
-
- /**
- * Whether to auto-start. Default is true.
- */
- private boolean autoStartup = true;
-
- /**
- * Lifecycle phase. Default is 0.
- */
- private int phase = 0;
-
- /**
- * Thread for running the ZooKeeper server.
- */
- private volatile Thread zkServerThread;
-
- /**
- * ZooKeeper server.
- */
- private volatile ZooKeeperServerMain zkServer;
-
- /**
- * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
- */
- private ErrorHandler errorHandler;
-
- private boolean daemon = true;
-
- /**
- * Construct an EmbeddedZooKeeper with a random port.
- */
- public EmbeddedZooKeeper() {
- clientPort = SocketUtils.findAvailableTcpPort();
- }
-
- /**
- * Construct an EmbeddedZooKeeper with the provided port.
- *
- * @param clientPort port for ZooKeeper server to bind to
- */
- public EmbeddedZooKeeper(int clientPort, boolean daemon) {
- this.clientPort = clientPort;
- this.daemon = daemon;
- }
-
- /**
- * Returns the port that clients should use to connect to this embedded server.
- *
- * @return dynamically determined client port
- */
- public int getClientPort() {
- return this.clientPort;
- }
-
- /**
- * Specify whether to start automatically. Default is true.
- *
- * @param autoStartup whether to start automatically
- */
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- /**
- * Specify the lifecycle phase for the embedded server.
- *
- * @param phase the lifecycle phase
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRunning() {
- return (zkServerThread != null);
- }
-
- /**
- * Start the ZooKeeper server in a background thread.
- * <p>
- * Register an error handler via {@link #setErrorHandler} in order to handle
- * any exceptions thrown during startup or execution.
- */
- @Override
- public synchronized void start() {
- if (zkServerThread == null) {
- zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
- zkServerThread.setDaemon(daemon);
- zkServerThread.start();
- }
- }
-
- /**
- * Shutdown the ZooKeeper server.
- */
- @Override
- public synchronized void stop() {
- if (zkServerThread != null) {
- // The shutdown method is protected...thus this hack to invoke it.
- // This will log an exception on shutdown; see
- // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
- try {
- Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
- shutdown.setAccessible(true);
- shutdown.invoke(zkServer);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- // It is expected that the thread will exit after
- // the server is shutdown; this will block until
- // the shutdown is complete.
- try {
- zkServerThread.join(5000);
- zkServerThread = null;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
- // abandoning zk thread
- zkServerThread = null;
- }
- }
- }
-
- /**
- * Stop the server if running and invoke the callback when complete.
- */
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- /**
- * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
- * is provided, only error-level logging will occur.
- *
- * @param errorHandler the {@link ErrorHandler} to be invoked
- */
- public void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Runnable implementation that starts the ZooKeeper server.
- */
- private class ServerRunnable implements Runnable {
-
- @Override
- public void run() {
- try {
- Properties properties = new Properties();
- File file = new File(System.getProperty("java.io.tmpdir")
- + File.separator + UUID.randomUUID());
- file.deleteOnExit();
- properties.setProperty("dataDir", file.getAbsolutePath());
- properties.setProperty("clientPort", String.valueOf(clientPort));
-
- QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
- quorumPeerConfig.parseProperties(properties);
-
- zkServer = new ZooKeeperServerMain();
- ServerConfig configuration = new ServerConfig();
- configuration.readFrom(quorumPeerConfig);
-
- zkServer.runFromConfig(configuration);
- } catch (Exception e) {
- if (errorHandler != null) {
- errorHandler.handleError(e);
- } else {
- logger.error("Exception running embedded ZooKeeper", e);
- }
- }
- }
- }
-
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/ProtobufProvider.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/ProtobufProvider.java
deleted file mode 100644
index 3a2daffe..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/java/org/apache/dubbo/test/serialization/protobuf/ProtobufProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * 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.dubbo.test.serialization.protobuf;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.concurrent.CountDownLatch;
-
-public class ProtobufProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- // wait for embedded zookeeper start completely.
- Thread.sleep(1000);
-
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
- }
-}
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/proto/DemoService.proto b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/proto/DemoService.proto
deleted file mode 100644
index 6bab478d..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/proto/DemoService.proto
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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.
-
-syntax = "proto3";
-
-import "google/protobuf/empty.proto";
-import "google/protobuf/wrappers.proto";
-
-option java_multiple_files = true;
-option java_package = "org.apache.dubbo.test.serialization.protobuf";
-option java_outer_classname = "DemoServiceProto";
-option objc_class_prefix = "DEMOSRV";
-
-package demoservice;
-
-// The demo service definition.
-service DemoService {
- rpc testVoid (google.protobuf.Empty) returns (google.protobuf.Empty) {}
- rpc testString (google.protobuf.StringValue) returns (google.protobuf.StringValue) {}
- rpc testBase (google.protobuf.Int32Value) returns (google.protobuf.Int32Value) {}
- rpc testObject (BigPerson) returns (BigPerson) {}
-}
-
-message BigPerson {
- string personId = 1;
- string loginName = 2;
- enum PersonStatus {
- ENABLED = 0;
- DISABLED = 1;
- }
- PersonStatus status = 3;
- string email = 4;
- string penName = 5;
- PersonInfo infoProfile = 6;
-}
-
-message PersonInfo{
- repeated Phone phones = 1;
- Phone fax = 2;
- FullAddress fullAddress = 3;
- string mobileNo = 4;
- string name = 5;
- bool male = 6;
- bool female = 7;
- string department = 8;
- string jobTitle = 9;
- string homepageUrl = 10;
-}
-
-message Phone{
- string country = 1;
- string area = 2;
- string number = 3;
- string extensionNumber = 4;
-}
-
-message FullAddress{
- string countryId = 1;
- string countryName = 2;
- string provinceName = 3;
- string cityId = 4;
- string cityName = 5;
- string streetAddress = 6;
- string zipCode = 7;
-}
-
-
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/log4j.properties b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/log4j.properties
deleted file mode 100644
index 1f8fe1ec..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# 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.
-#
-#
-###set log levels###
-log4j.rootLogger=info, stdout
-###output to the console###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/spring/dubbo-demo-consumer.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index abeb41c5..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-protobuf-consumer"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <dubbo:reference id="demoService" check="true"
- interface="org.apache.dubbo.test.serialization.protobuf.DemoService"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/spring/dubbo-demo-provider.xml b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/spring/dubbo-demo-provider.xml
deleted file mode 100644
index d11b4075..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/main/resources/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
- <context:property-placeholder/>
-
- <dubbo:application name="serialization-protobuf-provider"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <bean id="demoService" class="org.apache.dubbo.test.serialization.protobuf.DemoServiceImpl"/>
-
- <dubbo:service interface="org.apache.dubbo.test.serialization.protobuf.DemoService" ref="demoService"
- serialization="protobuf-json"/>
-
-</beans>
diff --git a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/test/java/DemoServiceIT.java b/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/test/java/DemoServiceIT.java
deleted file mode 100644
index 950dca6c..00000000
--- a/test/scenarios/scenarios-dubbo-serialization/dubbo-serialization-protobuf-test/src/test/java/DemoServiceIT.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
... 1858 lines suppressed ...