This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new c9af41ad Add test case to verify async (#995)
c9af41ad is described below
commit c9af41ade1884a9f5de0a089a3a3cbedffba2c1c
Author: Albumen Kevin <[email protected]>
AuthorDate: Wed Sep 27 09:48:11 2023 +0800
Add test case to verify async (#995)
---
.../case-configuration.yml | 23 +++
.../case-versions.conf | 25 +++
.../dubbo-samples-test-abc-async/pom.xml | 186 +++++++++++++++++++++
.../org/apache/dubbo/samples/test/Provider.java | 35 ++++
.../apache/dubbo/samples/test/api/DemoService.java | 28 ++++
.../dubbo/samples/test/api/DemoService2.java | 28 ++++
.../dubbo/samples/test/impl/DemoService2Impl.java | 39 +++++
.../dubbo/samples/test/impl/DemoServiceImpl.java | 116 +++++++++++++
.../src/main/resources/log4j.properties | 26 +++
.../src/main/resources/spring/provider.xml | 43 +++++
.../org/apache/dubbo/samples/test/ConsumerIT.java | 58 +++++++
.../src/test/resources/spring/consumer.xml | 33 ++++
99-integration/pom.xml | 1 +
13 files changed, 641 insertions(+)
diff --git a/99-integration/dubbo-samples-test-abc-async/case-configuration.yml
b/99-integration/dubbo-samples-test-abc-async/case-configuration.yml
new file mode 100644
index 00000000..14ca2d98
--- /dev/null
+++ b/99-integration/dubbo-samples-test-abc-async/case-configuration.yml
@@ -0,0 +1,23 @@
+# 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-external-zookeeper.yml
+
+props:
+ project_name: dubbo-samples-test-abc-async
+ main_class: org.apache.dubbo.samples.test.Provider
+ dubbo_port: 20880
+ check_log: "dubbo service started"
diff --git a/99-integration/dubbo-samples-test-abc-async/case-versions.conf
b/99-integration/dubbo-samples-test-abc-async/case-versions.conf
new file mode 100644
index 00000000..5ab45abb
--- /dev/null
+++ b/99-integration/dubbo-samples-test-abc-async/case-versions.conf
@@ -0,0 +1,25 @@
+#
+#
+# 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.
+#
+
+
+# Supported component versions of the test case
+
+# Spring app
+dubbo.version=2.7*, 3.*
+spring.version=4.*, 5.*, 6.*
+java.version= [>= 8]
diff --git a/99-integration/dubbo-samples-test-abc-async/pom.xml
b/99-integration/dubbo-samples-test-abc-async/pom.xml
new file mode 100644
index 00000000..6b517a77
--- /dev/null
+++ b/99-integration/dubbo-samples-test-abc-async/pom.xml
@@ -0,0 +1,186 @@
+<?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</groupId>
+ <artifactId>apache</artifactId>
+ <version>23</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-samples-test-abc-async</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>Dubbo Samples Test for abc-async</name>
+ <description>Dubbo Samples Test for abc-async</description>
+
+ <properties>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>3.2.6</dubbo.version>
+ <spring.version>5.3.25</spring.version>
+ <zookeeper_version>3.8.1</zookeeper_version>
+ <junit.version>4.13.1</junit.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-curator5</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>parent</artifactId>
+ <version>${zookeeper_version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.7.25</version>
+ </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-curator5</artifactId>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>cn.hutool</groupId>
+ <artifactId>hutool-all</artifactId>
+ <version>5.8.16</version>
+ </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>
+
+
+ <!-- Embedded Zookeeper Server dependencies START -->
+ <dependency>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-annotations</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.xerial.snappy</groupId>
+ <artifactId>snappy-java</artifactId>
+ </dependency>
+ <!-- Embedded Zookeeper Server dependencies END -->
+ </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>3.7.0</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/Provider.java
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/Provider.java
new file mode 100644
index 00000000..9010c4e3
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/Provider.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.samples.test;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.concurrent.CountDownLatch;
+
+public class Provider {
+
+ public static void main(String[] args) throws Exception {
+ ClassPathXmlApplicationContext context = new
ClassPathXmlApplicationContext("spring/provider.xml");
+ context.start();
+
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+}
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/api/DemoService.java
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/api/DemoService.java
new file mode 100644
index 00000000..d595cfff
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/api/DemoService.java
@@ -0,0 +1,28 @@
+/*
+ *
+ * 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.samples.test.api;
+
+import java.util.concurrent.CompletableFuture;
+
+public interface DemoService {
+ String commonInvoke(String param);
+
+ CompletableFuture<String> asyncInvoke(String param);
+}
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/api/DemoService2.java
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/api/DemoService2.java
new file mode 100644
index 00000000..8773f376
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/api/DemoService2.java
@@ -0,0 +1,28 @@
+/*
+ *
+ * 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.samples.test.api;
+
+import java.util.concurrent.CompletableFuture;
+
+public interface DemoService2 {
+ String commonInvoke(String param);
+
+ CompletableFuture<String> asyncInvoke(String param);
+}
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/impl/DemoService2Impl.java
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/impl/DemoService2Impl.java
new file mode 100644
index 00000000..9472de28
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/impl/DemoService2Impl.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.samples.test.impl;
+
+import org.apache.dubbo.samples.test.api.DemoService2;
+
+import java.util.concurrent.CompletableFuture;
+
+public class DemoService2Impl implements DemoService2 {
+
+ @Override
+ public String commonInvoke(String param) {
+ return param;
+ }
+
+ @Override
+ public CompletableFuture<String> asyncInvoke(String param) {
+ CompletableFuture<String> future = new CompletableFuture<>();
+ future.complete(param);
+ return future;
+ }
+}
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/impl/DemoServiceImpl.java
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/impl/DemoServiceImpl.java
new file mode 100644
index 00000000..6385935d
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/main/java/org/apache/dubbo/samples/test/impl/DemoServiceImpl.java
@@ -0,0 +1,116 @@
+/*
+ *
+ * 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.samples.test.impl;
+
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.samples.test.api.DemoService;
+import org.apache.dubbo.samples.test.api.DemoService2;
+
+import cn.hutool.core.util.RandomUtil;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+
+public class DemoServiceImpl implements DemoService {
+ private final DemoService2 demoService2;
+
+ public DemoServiceImpl(DemoService2 demoService2) {
+ this.demoService2 = demoService2;
+ }
+
+ @Override
+ public String commonInvoke(String param) {
+ String randomStr1 = RandomUtil.randomString(1000);
+ if (!randomStr1.equals(demoService2.commonInvoke(randomStr1))) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+
+ String randomStr2 = RandomUtil.randomString(1000);
+ try {
+ if
(!randomStr2.equals(demoService2.asyncInvoke(randomStr2).get())) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ String randomStr3 = RandomUtil.randomString(1000);
+ try {
+ if
(!randomStr3.equals(RpcContext.getClientAttachment().asyncCall(() ->
demoService2.commonInvoke(randomStr3)).get())) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ String randomStr4 = RandomUtil.randomString(1000);
+ try {
+ if (!randomStr4.equals(RpcContext.getClientAttachment().asyncCall(
+ () -> demoService2.asyncInvoke(randomStr4).get()).get())) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ return param;
+ }
+
+ @Override
+ public CompletableFuture<String> asyncInvoke(String param) {
+ CompletableFuture<String> future = new CompletableFuture<>();
+ new Thread(() -> {
+ String randomStr1 = RandomUtil.randomString(1000);
+ if (!randomStr1.equals(demoService2.commonInvoke(randomStr1))) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+
+ String randomStr2 = RandomUtil.randomString(1000);
+ try {
+ if
(!randomStr2.equals(demoService2.asyncInvoke(randomStr2).get())) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ String randomStr3 = RandomUtil.randomString(1000);
+ try {
+ if
(!randomStr3.equals(RpcContext.getClientAttachment().asyncCall(() ->
demoService2.commonInvoke(randomStr3)).get())) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+
+ String randomStr4 = RandomUtil.randomString(1000);
+ try {
+ if
(!randomStr4.equals(RpcContext.getClientAttachment().asyncCall(
+ () ->
demoService2.asyncInvoke(randomStr4).get()).get())) {
+ throw new IllegalStateException("commonInvoke failed");
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ future.complete(param);
+ }).start();
+ return future;
+ }
+}
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/main/resources/log4j.properties
b/99-integration/dubbo-samples-test-abc-async/src/main/resources/log4j.properties
new file mode 100644
index 00000000..d603f32b
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/main/resources/log4j.properties
@@ -0,0 +1,26 @@
+#
+#
+# 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/99-integration/dubbo-samples-test-abc-async/src/main/resources/spring/provider.xml
b/99-integration/dubbo-samples-test-abc-async/src/main/resources/spring/provider.xml
new file mode 100644
index 00000000..cc757616
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/main/resources/spring/provider.xml
@@ -0,0 +1,43 @@
+<?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="decode-provider" qos-port="22123"/>
+
+ <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
+
+ <dubbo:provider token="true"/>
+
+ <bean id="demoService"
class="org.apache.dubbo.samples.test.impl.DemoServiceImpl">
+ <constructor-arg ref="remoteDemoService2"/>
+ </bean>
+ <bean id="demoService2"
class="org.apache.dubbo.samples.test.impl.DemoService2Impl"/>
+
+ <dubbo:service interface="org.apache.dubbo.samples.test.api.DemoService"
ref="demoService"/>
+ <dubbo:service interface="org.apache.dubbo.samples.test.api.DemoService2"
ref="demoService2"/>
+
+ <dubbo:reference id="remoteDemoService2" scope="remote"
+
interface="org.apache.dubbo.samples.test.api.DemoService2"/>
+
+</beans>
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/test/java/org/apache/dubbo/samples/test/ConsumerIT.java
b/99-integration/dubbo-samples-test-abc-async/src/test/java/org/apache/dubbo/samples/test/ConsumerIT.java
new file mode 100644
index 00000000..ed888da4
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/test/java/org/apache/dubbo/samples/test/ConsumerIT.java
@@ -0,0 +1,58 @@
+/*
+ *
+ * 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.samples.test;
+
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.samples.test.api.DemoService;
+
+import cn.hutool.core.util.RandomUtil;
+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.concurrent.ExecutionException;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:/spring/consumer.xml"})
+public class ConsumerIT {
+ @Autowired
+ @Qualifier("demoService1")
+ private DemoService demoService;
+
+ @Test
+ public void test() throws ExecutionException, InterruptedException {
+ String randomStr1 = RandomUtil.randomString(1000);
+ Assert.assertEquals(randomStr1, demoService.commonInvoke(randomStr1));
+
+ String randomStr2 = RandomUtil.randomString(1000);
+ Assert.assertEquals(randomStr2,
demoService.asyncInvoke(randomStr2).get());
+
+ String randomStr3 = RandomUtil.randomString(1000);
+ Assert.assertEquals(randomStr3,
RpcContext.getClientAttachment().asyncCall(
+ () -> demoService.commonInvoke(randomStr3)).get());
+
+ String randomStr4 = RandomUtil.randomString(1000);
+ Assert.assertEquals(randomStr4,
RpcContext.getClientAttachment().asyncCall(
+ () -> demoService.asyncInvoke(randomStr4).get()).get());
+ }
+}
diff --git
a/99-integration/dubbo-samples-test-abc-async/src/test/resources/spring/consumer.xml
b/99-integration/dubbo-samples-test-abc-async/src/test/resources/spring/consumer.xml
new file mode 100644
index 00000000..2c4fdace
--- /dev/null
+++
b/99-integration/dubbo-samples-test-abc-async/src/test/resources/spring/consumer.xml
@@ -0,0 +1,33 @@
+<?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="decode-consumer"/>
+
+ <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
+
+ <dubbo:reference id="demoService1" check="false"
+
interface="org.apache.dubbo.samples.test.api.DemoService"/>
+
+</beans>
diff --git a/99-integration/pom.xml b/99-integration/pom.xml
index 6f69cda9..3251b724 100644
--- a/99-integration/pom.xml
+++ b/99-integration/pom.xml
@@ -68,6 +68,7 @@
<module>dubbo-samples-test-12631</module>
<module>dubbo-samples-test-12697</module>
<module>dubbo-samples-test-13133</module>
+ <module>dubbo-samples-test-abc-async</module>
<module>dubbo-samples-test-register</module>
<module>dubbo-samples-test-register-3-3</module>
<module>dubbo-samples-transaction</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]