You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by il...@apache.org on 2019/06/20 11:24:02 UTC

[dubbo-samples] branch master updated: integration test for dubbo-samples-generic-call

This is an automated email from the ASF dual-hosted git repository.

iluo 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 6195ced  integration test for dubbo-samples-generic-call
6195ced is described below

commit 6195ced5ee756d7238f0f78f6c47a2cf809c7a0c
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Thu Jun 20 19:23:04 2019 +0800

    integration test for dubbo-samples-generic-call
---
 .../samples/generic/call/api/GenericType.java      |  22 +-
 .../dubbo/samples/generic/call/api/Person.java     |  11 +-
 .../dubbo-samples-generic-call-consumer/pom.xml    |  39 +++
 .../samples/generic/call/GenericCallConsumer.java  | 110 +++++++-
 .../dubbo-samples-generic-call-provider/pom.xml    | 160 +++++++++++
 .../samples/generic/call/GenericCallProvider.java  |  10 +-
 .../generic/call/impl/HelloServiceImpl.java        |  32 ++-
 .../src/main/resources/spring/generic-provider.xml |   9 +-
 .../apache/dubbo/samples/generic/call/FooIT.java}  |  23 +-
 .../dubbo/samples/generic/call/HelloServiceIT.java | 159 +++++++++++
 .../dubbo-samples-generic-call/pom.xml             | 296 +--------------------
 11 files changed, 529 insertions(+), 342 deletions(-)

diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/GenericType.java b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/GenericType.java
index 77ee4e7..820fce9 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/GenericType.java
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/GenericType.java
@@ -18,21 +18,25 @@ package org.apache.dubbo.samples.generic.call.api;
 
 import java.io.Serializable;
 
-/**
- *
- */
 public class GenericType<T> implements Serializable {
-    private T aa;
+    private T type;
 
     public GenericType(T aa) {
-        this.aa = aa;
+        this.type = aa;
+    }
+
+    public T getType() {
+        return type;
     }
 
-    public T getAa() {
-        return aa;
+    public void setType(T t) {
+        this.type = t;
     }
 
-    public void setAa(T aa) {
-        this.aa = aa;
+    @Override
+    public String toString() {
+        return "GenericType{" +
+                "type=" + type +
+                '}';
     }
 }
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/Person.java b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/Person.java
index 108671e..e24770e 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/Person.java
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/Person.java
@@ -18,9 +18,6 @@ package org.apache.dubbo.samples.generic.call.api;
 
 import java.io.Serializable;
 
-/**
- *
- */
 public class Person implements Serializable {
     private int id;
     private String name;
@@ -45,4 +42,12 @@ public class Person implements Serializable {
     public void setName(String name) {
         this.name = name;
     }
+
+    @Override
+    public String toString() {
+        return "Person{" +
+                "id=" + id +
+                ", name='" + name + '\'' +
+                '}';
+    }
 }
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/pom.xml b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/pom.xml
index 1cfb12c..9a88b1a 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/pom.xml
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/pom.xml
@@ -30,5 +30,44 @@
 
     <artifactId>dubbo-samples-generic-call-consumer</artifactId>
 
+    <properties>
+        <dubbo.version>2.7.2</dubbo.version>
+        <spring.version>4.3.16.RELEASE</spring.version>
+        <junit.version>4.12</junit.version>
+    </properties>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-samples-generic-call-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <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>
+    </dependencies>
 </project>
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallConsumer.java b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallConsumer.java
index 5e29dd8..cc13d33 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallConsumer.java
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-consumer/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallConsumer.java
@@ -26,12 +26,13 @@ import org.apache.dubbo.rpc.RpcContext;
 import org.apache.dubbo.rpc.service.GenericService;
 
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CountDownLatch;
 
 public class GenericCallConsumer {
 
     private static GenericService genericService;
 
-    public static void main(String[] args) throws Exception{
+    public static void main(String[] args) throws Exception {
         ApplicationConfig applicationConfig = new ApplicationConfig();
         applicationConfig.setName("generic-call-consumer");
         RegistryConfig registryConfig = new RegistryConfig();
@@ -45,32 +46,119 @@ public class GenericCallConsumer {
         referenceConfig.setTimeout(7000);
 
         genericService = referenceConfig.get();
-        $invokeWithNormalSignature();
-        // Generic call does not support method with CompletableFuture signature at present, will add support soon.
-        // $invokeWithAsyncSignature();
-        System.in.read();
+        invokeSayHello();
+        invokeSayHelloAsync();
+        invokeAsyncSayHelloAsync();
+        invokeAsyncSayHello();
+//        invokeSayHelloAsyncComplex();
+        asyncInvokeSayHelloAsyncComplex();
+//        invokeSayHelloAsyncGenericComplex();
+        asyncInvokeSayHelloAsyncGenericComplex();
     }
 
-    public static void $invokeWithNormalSignature() {
+    public static void invokeSayHello() throws InterruptedException {
         Object result = genericService.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
 
         CompletableFuture<String> future = RpcContext.getContext().getCompletableFuture();
         future.whenComplete((value, t) -> {
-            System.err.println(value);
+            System.err.println("invokeSayHello(whenComplete): " + value);
+            latch.countDown();
         });
 
-        System.out.println("...." + result);
+        System.err.println("invokeSayHello(return): " + result);
+        latch.await();
     }
 
-    public static void $invokeWithAsyncSignature() {
+    public static void invokeSayHelloAsync() throws InterruptedException {
         Object result = genericService.$invoke("sayHelloAsync", new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
 
         CompletableFuture<String> future = RpcContext.getContext().getCompletableFuture();
         future.whenComplete((value, t) -> {
-            System.err.println(value);
+            System.err.println("invokeSayHelloAsync(whenComplete): " + value);
+            latch.countDown();
         });
 
-        System.out.println("...." + result);
+        System.err.println("invokeSayHelloAsync(return): " + result);
+        latch.await();
     }
 
+    public static void invokeAsyncSayHelloAsync() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHelloAsync",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeAsyncSayHelloAsync(whenComplete): " + value);
+            latch.countDown();
+        });
+        latch.await();
+    }
+
+    public static void invokeAsyncSayHello() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHello",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeAsyncSayHello(whenComplete): " + value);
+            latch.countDown();
+        });
+        latch.await();
+    }
+
+    public static void invokeSayHelloAsyncComplex() throws Exception {
+        Object result = genericService.$invoke("sayHelloAsyncComplex", new String[]{"java.lang.String"},
+                new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        CompletableFuture<String> future = RpcContext.getContext().getCompletableFuture();
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeSayHelloAsyncComplex(whenComplete): " + value);
+            latch.countDown();
+        });
+
+        System.err.println("invokeSayHelloAsync(return): " + result);
+        latch.await();
+    }
+
+    public static void asyncInvokeSayHelloAsyncComplex() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHelloAsyncComplex",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        future.whenComplete((value, t) -> {
+            System.err.println("asyncInvokeSayHelloAsyncComplex(whenComplete): " + value);
+            latch.countDown();
+        });
+
+        latch.await();
+    }
+
+    public static void invokeSayHelloAsyncGenericComplex() throws Exception {
+        Object result = genericService.$invoke("sayHelloAsyncGenericComplex", new String[]{"java.lang.String"},
+                new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        CompletableFuture<String> future = RpcContext.getContext().getCompletableFuture();
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeSayHelloAsyncGenericComplex(whenComplete): " + value);
+            latch.countDown();
+        });
+
+        System.err.println("invokeSayHelloAsyncGenericComplex(return): " + result);
+        latch.await();
+    }
+
+    public static void asyncInvokeSayHelloAsyncGenericComplex() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHelloAsyncGenericComplex",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        future.whenComplete((value, t) -> {
+            System.err.println("asyncInvokeSayHelloAsyncGenericComplex(whenComplete): " + value);
+            latch.countDown();
+        });
+
+        latch.await();
+    }
 }
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/pom.xml b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/pom.xml
index 13232c1..a4d366f 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/pom.xml
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/pom.xml
@@ -30,12 +30,172 @@
 
     <artifactId>dubbo-samples-generic-call-provider</artifactId>
 
+    <properties>
+        <source.level>1.8</source.level>
+        <target.level>1.8</target.level>
+        <dubbo.version>2.7.2</dubbo.version>
+        <spring.version>4.3.16.RELEASE</spring.version>
+        <junit.version>4.12</junit.version>
+        <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
+        <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
+        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+        <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
+        <image.name>${artifactId}:${dubbo.version}</image.name>
+        <dubbo.port>20880</dubbo.port>
+        <zookeeper.port>2181</zookeeper.port>
+        <main-class>org.apache.dubbo.samples.generic.call.GenericCallProvider</main-class>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo-samples-generic-call-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <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>
     </dependencies>
 
+    <profiles>
+        <profile>
+            <id>dubbo-integration-test</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.dubbo</groupId>
+                        <artifactId>dubbo-maven-address-plugin</artifactId>
+                        <version>1.0-SNAPSHOT</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>local-address</goal>
+                                </goals>
+                                <configuration>
+                                    <localAddress>dubbo-local-address</localAddress>
+                                </configuration>
+                                <phase>initialize</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>com.google.cloud.tools</groupId>
+                        <artifactId>jib-maven-plugin</artifactId>
+                        <version>${jib-maven-plugin.version}</version>
+                        <configuration>
+                            <from>
+                                <image>openjdk:8</image>
+                            </from>
+                            <to>
+                                <image>${image.name}</image>
+                            </to>
+                            <container>
+                                <mainClass>${main-class}</mainClass>
+                                <ports>
+                                    <port>${dubbo.port}</port>
+                                    <port>${zookeeper.port}</port>
+                                </ports>
+                                <environment>
+                                    <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
+                                </environment>
+                            </container>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>dockerBuild</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>${docker-maven-plugin.version}</version>
+                        <configuration>
+                            <images>
+                                <image>
+                                    <name>${image.name}</name>
+                                    <run>
+                                        <ports>
+                                            <port>${dubbo.port}:${dubbo.port}</port>
+                                            <port>${zookeeper.port}:${zookeeper.port}</port>
+                                        </ports>
+                                        <wait>
+                                            <log>dubbo service started</log>
+                                        </wait>
+                                    </run>
+                                </image>
+                            </images>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>start</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>start</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>stop</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>stop</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <version>${maven-failsafe-plugin.version}</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                    <systemPropertyVariables>
+                                        <zookeeper.address>${dubbo-local-address}</zookeeper.address>
+                                    </systemPropertyVariables>
+                                    <includes>
+                                        <include>**/*IT.java</include>
+                                    </includes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallProvider.java b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallProvider.java
index 8970f5d..3825c5d 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallProvider.java
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/GenericCallProvider.java
@@ -21,16 +21,16 @@ package org.apache.dubbo.samples.generic.call;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-/**
- * GenericCallProvider
- */
+import java.util.concurrent.CountDownLatch;
+
 public class GenericCallProvider {
 
     public static void main(String[] args) throws Exception {
         new EmbeddedZooKeeper(2181, false).start();
-        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring/generic-provider.xml"});
+        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/generic-provider.xml");
         context.start();
-        System.in.read();
+        System.out.println("dubbo service started");
+        new CountDownLatch(1).await();
     }
 
 }
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/impl/HelloServiceImpl.java b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/impl/HelloServiceImpl.java
index 9535f5d..edc5cac 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/impl/HelloServiceImpl.java
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/java/org/apache/dubbo/samples/generic/call/impl/HelloServiceImpl.java
@@ -29,12 +29,11 @@ public class HelloServiceImpl implements HelloService {
 
     @Override
     public String sayHello(String name) {
-        return "=======" + "Hello " + name + "========";
+        return "sayHello: " + name;
     }
 
     @Override
     public CompletableFuture<String> sayHelloAsync(String name) {
-        System.err.println("executing");
         CompletableFuture<String> future = new CompletableFuture<>();
         new Thread(() -> {
             try {
@@ -42,7 +41,7 @@ public class HelloServiceImpl implements HelloService {
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
-            future.complete("hahaha");
+            future.complete("sayHelloAsync: " + name);
         }).start();
 
         return future;
@@ -50,11 +49,34 @@ public class HelloServiceImpl implements HelloService {
 
     @Override
     public CompletableFuture<Person> sayHelloAsyncComplex(String name) {
-        return null;
+        Person person = new Person(1, "sayHelloAsyncComplex: " + name);
+        CompletableFuture<Person> future = new CompletableFuture<>();
+        new Thread(() -> {
+            try {
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            future.complete(person);
+        }).start();
+
+        return future;
     }
 
     @Override
     public CompletableFuture<GenericType<Person>> sayHelloAsyncGenericComplex(String name) {
-        return null;
+        Person person = new Person(1, "sayHelloAsyncGenericComplex: " + name);
+        GenericType<Person> genericType = new GenericType<>(person);
+        CompletableFuture<GenericType<Person>> future = new CompletableFuture<>();
+        new Thread(() -> {
+            try {
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            future.complete(genericType);
+        }).start();
+
+        return future;
     }
 }
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/resources/spring/generic-provider.xml b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/resources/spring/generic-provider.xml
index 4c5d7c6..a2c45a7 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/resources/spring/generic-provider.xml
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/main/resources/spring/generic-provider.xml
@@ -20,13 +20,14 @@
 
 <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="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://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="generic-call"/>
+    <dubbo:application name="generic-provider"/>
 
-    <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
+    <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
 
     <dubbo:protocol name="dubbo" port="20880"/>
 
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/GenericType.java b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/test/java/org/apache/dubbo/samples/generic/call/FooIT.java
similarity index 71%
copy from dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/GenericType.java
copy to dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/test/java/org/apache/dubbo/samples/generic/call/FooIT.java
index 77ee4e7..f68c657 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-api/src/main/java/org/apache/dubbo/samples/generic/call/api/GenericType.java
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/test/java/org/apache/dubbo/samples/generic/call/FooIT.java
@@ -14,25 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.samples.generic.call.api;
 
-import java.io.Serializable;
+package org.apache.dubbo.samples.generic.call;
 
-/**
- *
- */
-public class GenericType<T> implements Serializable {
-    private T aa;
-
-    public GenericType(T aa) {
-        this.aa = aa;
-    }
-
-    public T getAa() {
-        return aa;
-    }
+import org.junit.Test;
 
-    public void setAa(T aa) {
-        this.aa = aa;
+public class FooIT {
+    @Test
+    public void test() throws Exception {
+        System.out.println(">>> what's up?");
     }
 }
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/test/java/org/apache/dubbo/samples/generic/call/HelloServiceIT.java b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/test/java/org/apache/dubbo/samples/generic/call/HelloServiceIT.java
new file mode 100644
index 0000000..d634130
--- /dev/null
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/dubbo-samples-generic-call-provider/src/test/java/org/apache/dubbo/samples/generic/call/HelloServiceIT.java
@@ -0,0 +1,159 @@
+/*
+ * 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.generic.call;
+
+import org.apache.dubbo.common.utils.PojoUtils;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.service.GenericService;
+import org.apache.dubbo.samples.generic.call.api.GenericType;
+import org.apache.dubbo.samples.generic.call.api.Person;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class HelloServiceIT {
+    private static GenericService genericService;
+    private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1");
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        System.out.println(">>> hello, hello");
+        ApplicationConfig applicationConfig = new ApplicationConfig();
+        applicationConfig.setName("generic-call-consumer");
+        RegistryConfig registryConfig = new RegistryConfig();
+        registryConfig.setAddress("zookeeper://" + zookeeperHost + ":2181");
+        ReferenceConfig<GenericService> referenceConfig = new ReferenceConfig<>();
+        referenceConfig.setInterface("org.apache.dubbo.samples.generic.call.api.HelloService");
+        applicationConfig.setRegistry(registryConfig);
+        referenceConfig.setApplication(applicationConfig);
+        referenceConfig.setGeneric(true);
+        referenceConfig.setAsync(true);
+        referenceConfig.setTimeout(7000);
+        genericService = referenceConfig.get();
+    }
+
+    @Test
+    public void invokeSayHello() throws InterruptedException {
+        Object result = genericService.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        CompletableFuture<String> future = RpcContext.getContext().getCompletableFuture();
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeSayHello(whenComplete): " + value);
+            Object o = PojoUtils.realize(value, String.class);
+            Assert.assertEquals("sayHello: world", o);
+            latch.countDown();
+        });
+
+        System.err.println("invokeSayHello(return): " + result);
+        Assert.assertNull(result);
+
+        latch.await(7000, TimeUnit.MILLISECONDS);
+    }
+
+    @Test
+    public void invokeSayHelloAsync() throws InterruptedException {
+        Object result = genericService.$invoke("sayHelloAsync", new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        CompletableFuture<String> future = RpcContext.getContext().getCompletableFuture();
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeSayHelloAsync(whenComplete): " + value);
+            Object o = PojoUtils.realize(value, String.class);
+            Assert.assertEquals("sayHelloAsync: world", o);
+            latch.countDown();
+        });
+
+        System.err.println("invokeSayHelloAsync(return): " + result);
+        Assert.assertNull(result);
+
+        latch.await(7000, TimeUnit.MILLISECONDS);
+    }
+
+    @Test
+    public void invokeAsyncSayHelloAsync() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHelloAsync",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeAsyncSayHelloAsync(whenComplete): " + value);
+            Object o = PojoUtils.realize(value, String.class);
+            Assert.assertEquals("sayHelloAsync: world", o);
+            latch.countDown();
+        });
+
+        latch.await(7000, TimeUnit.MILLISECONDS);
+    }
+
+    @Test
+    public void invokeAsyncSayHello() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHello",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+        future.whenComplete((value, t) -> {
+            System.err.println("invokeAsyncSayHello(whenComplete): " + value);
+            Object o = PojoUtils.realize(value, String.class);
+            Assert.assertEquals("sayHello: world", o);
+            latch.countDown();
+        });
+
+        latch.await(7000, TimeUnit.MILLISECONDS);
+    }
+
+    @Test
+    public void asyncInvokeSayHelloAsyncComplex() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHelloAsyncComplex",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        future.whenComplete((value, t) -> {
+            System.err.println("asyncInvokeSayHelloAsyncComplex(whenComplete): " + value);
+            Person p = (Person) PojoUtils.realize(value, Person.class);
+            Assert.assertEquals("sayHelloAsyncComplex: world", p.getName());
+            latch.countDown();
+        });
+
+        latch.await(7000, TimeUnit.MILLISECONDS);
+    }
+
+    @Test
+    public void asyncInvokeSayHelloAsyncGenericComplex() throws Exception {
+        CompletableFuture<Object> future = genericService.$invokeAsync("sayHelloAsyncGenericComplex",
+                new String[]{"java.lang.String"}, new Object[]{"world"});
+        CountDownLatch latch = new CountDownLatch(1);
+
+        future.whenComplete((value, t) -> {
+            System.err.println("asyncInvokeSayHelloAsyncGenericComplex(whenComplete): " + value);
+            GenericType g = (GenericType) PojoUtils.realize(value, GenericType.class);
+            Assert.assertTrue(g.getType() instanceof Person);
+            Person p = (Person)g.getType();
+            Assert.assertEquals("sayHelloAsyncGenericComplex: world", p.getName());
+            latch.countDown();
+        });
+
+        latch.await(7000, TimeUnit.MILLISECONDS);
+    }
+}
diff --git a/dubbo-samples-generic/dubbo-samples-generic-call/pom.xml b/dubbo-samples-generic/dubbo-samples-generic-call/pom.xml
index 17f9745..8acda03 100644
--- a/dubbo-samples-generic/dubbo-samples-generic-call/pom.xml
+++ b/dubbo-samples-generic/dubbo-samples-generic-call/pom.xml
@@ -30,311 +30,31 @@
     <packaging>pom</packaging>
     <artifactId>dubbo-samples-generic-call</artifactId>
 
-    <modules>
-        <module>dubbo-samples-generic-call-api</module>
-        <module>dubbo-samples-generic-call-provider</module>
-        <module>dubbo-samples-generic-call-consumer</module>
-    </modules>
-
-
     <properties>
         <source.level>1.8</source.level>
         <target.level>1.8</target.level>
-        <spring.version>4.3.16.RELEASE</spring.version>
-        <dubbo.version>2.7.1</dubbo.version>
-        <dubbo.rpc.version>2.7.1</dubbo.rpc.version>
-        <zookeeper.version>3.4.13</zookeeper.version>
-        <curator.version>4.0.1</curator.version>
-        <validation-api.version>1.1.0.Final</validation-api.version>
-        <hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
-        <resteasy.version>3.0.19.Final</resteasy.version>
-        <curator-client.version>4.0.1</curator-client.version>
-        <swagger.version>1.5.19</swagger.version>
-        <tomcat.version>7.0.88</tomcat.version>
-        <servlet.version>3.0.1</servlet.version>
-        <maven_checkstyle_version>3.0.0</maven_checkstyle_version>
-        <apache-rat-plugin.version>0.12</apache-rat-plugin.version>
-        <spring-boot.version>1.5.13.RELEASE</spring-boot.version>
+        <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>
-                <!-- Import dependency management from Spring Boot -->
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring-boot.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>io.netty</groupId>
-                <artifactId>netty-all</artifactId>
-                <version>4.1.16.Final</version>
-            </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</artifactId>
-                <version>${dubbo.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.thrift</groupId>
-                        <artifactId>libthrift</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo-rpc-rest</artifactId>
-                <version>${dubbo.rpc.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.zookeeper</groupId>
-                <artifactId>zookeeper</artifactId>
-                <version>${zookeeper.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.curator</groupId>
-                <artifactId>curator-framework</artifactId>
-                <version>${curator.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.zookeeper</groupId>
-                        <artifactId>zookeeper</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>javax.validation</groupId>
-                <artifactId>validation-api</artifactId>
-                <version>${validation-api.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.hibernate</groupId>
-                <artifactId>hibernate-validator</artifactId>
-                <version>${hibernate-validator.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.jboss.resteasy</groupId>
-                <artifactId>resteasy-jackson-provider</artifactId>
-                <version>${resteasy.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.curator</groupId>
-                <artifactId>curator-client</artifactId>
-                <version>${curator-client.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.zookeeper</groupId>
-                        <artifactId>zookeeper</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>javax.servlet</groupId>
-                <artifactId>javax.servlet-api</artifactId>
-                <version>${servlet.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.tomcat.embed</groupId>
-                <artifactId>tomcat-embed-core</artifactId>
-                <version>${tomcat.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.tomcat.embed</groupId>
-                <artifactId>tomcat-embed-logging-juli</artifactId>
-                <version>${tomcat.version}</version>
-            </dependency>
-            <!-- swagger -->
-            <dependency>
-                <groupId>io.swagger</groupId>
-                <artifactId>swagger-annotations</artifactId>
-                <version>${swagger.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.swagger</groupId>
-                <artifactId>swagger-jaxrs</artifactId>
-                <version>${swagger.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.curator</groupId>
-            <artifactId>curator-framework</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>io.netty</groupId>
-                    <artifactId>netty</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.zookeeper</groupId>
-                    <artifactId>zookeeper</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-configcenter-zookeeper</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.netty</groupId>
-            <artifactId>netty-all</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-configcenter-zookeeper</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-metadata-report-api</artifactId>
-        </dependency>
-    </dependencies>
-
 
+    <modules>
+        <module>dubbo-samples-generic-call-api</module>
+        <module>dubbo-samples-generic-call-provider</module>
+        <module>dubbo-samples-generic-call-consumer</module>
+    </modules>
 
     <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-maven-plugin</artifactId>
-                    <version>${spring-boot.version}</version>
-                </plugin>
-            </plugins>
-        </pluginManagement>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.7.0</version>
+                <version>${maven-compiler-plugin.version}</version>
                 <configuration>
                     <source>${source.level}</source>
                     <target>${target.level}</target>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <version>${apache-rat-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <id>verify.rat</id>
-                        <phase>verify</phase>
-                        <goals>
-                            <goal>check</goal>
-                        </goals>
-                        <configuration>
-                            <excludes>
-                                <exclude>**/*.versionsBackup</exclude>
-                                <exclude>**/.idea/</exclude>
-                                <exclude>**/*.iml</exclude>
-                                <exclude>**/*.txt</exclude>
-                                <exclude>**/*.load</exclude>
-                                <exclude>**/*.flex</exclude>
-                                <exclude>**/*.fc</exclude>
-                                <exclude>**/*.javascript</exclude>
-                                <exclude>**/*.properties</exclude>
-                                <exclude>**/*.thrift</exclude>
-                                <exclude>**/*.sh</exclude>
-                                <exclude>**/*.bat</exclude>
-                                <exclude>**/*.md</exclude>
-                                <exclude>.git/</exclude>
-                                <exclude>.gitignore</exclude>
-                                <!-- ASF jenkins box puts the Maven repo in our root directory. -->
-                                <exclude>.repository/</exclude>
-                                <exclude>**/.settings/*</exclude>
-                                <exclude>**/.classpath</exclude>
-                                <exclude>**/.project</exclude>
-                                <exclude>**/target/**</exclude>
-                                <exclude>**/*.log</exclude>
-                                <exclude>CODE_OF_CONDUCT.md</exclude>
-                                <exclude>.codecov.yml</exclude>
-                                <exclude>.travis.yml</exclude>
-                                <exclude>PULL_REQUEST_TEMPLATE.md</exclude>
-                                <exclude>CONTRIBUTING.md</exclude>
-                                <exclude>README.md</exclude>
-                                <exclude>**/codestyle/*</exclude>
-                                <exclude>**/resources/META-INF/**</exclude>
-                                <exclude>**/webapp/swagger/**</exclude>
-                                <exclude>**/org/apache/dubbo/samples/rpc/nativethrift/api/DemoService.java</exclude>
-                            </excludes>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
     </build>
 
-    <profiles>
-        <profile>
-            <id>checkstyle</id>
-            <activation>
-                <jdk>[1.8,)</jdk>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-checkstyle-plugin</artifactId>
-                        <version>${maven_checkstyle_version}</version>
-                        <dependencies>
-                            <dependency>
-                                <groupId>com.puppycrawl.tools</groupId>
-                                <artifactId>checkstyle</artifactId>
-                                <version>8.9</version>
-                            </dependency>
-                        </dependencies>
-                        <executions>
-                            <execution>
-                                <id>checkstyle-validation</id>
-                                <phase>validate</phase>
-                                <configuration>
-                                    <configLocation>../../codestyle/checkstyle.xml</configLocation>
-                                    <suppressionsLocation>../../codestyle/checkstyle-suppressions.xml</suppressionsLocation>
-                                    <encoding>UTF-8</encoding>
-                                    <consoleOutput>true</consoleOutput>
-                                    <failOnViolation>true</failOnViolation>
-                                </configuration>
-                                <goals>
-                                    <goal>check</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-</project>
\ No newline at end of file
+</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org