You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by gu...@apache.org on 2021/10/29 03:03:40 UTC

[dubbo-samples] branch master updated: add overload method test case

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

guohao 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 e60ab13  add overload method test case
     new d467e02  Merge pull request #386 from EarthChen/feature/overload-method
e60ab13 is described below

commit e60ab13fb9aa3ae73dad7bfb46b706ebd059afe4
Author: earthchen <yo...@duobei.com>
AuthorDate: Thu Oct 28 14:46:46 2021 +0800

    add overload method test case
---
 .../org/apache/dubbo/sample/tri/service/WrapGreeter.java     |  6 ++++++
 .../dubbo/sample/tri/service/impl/WrapGreeterImpl.java       | 12 +++++++++++-
 .../org/apache/dubbo/sample/tri/BaseTriWrapConsumerTest.java | 10 +++++++++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/WrapGreeter.java b/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/WrapGreeter.java
index 2e182dd..d0d5303 100644
--- a/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/WrapGreeter.java
+++ b/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/WrapGreeter.java
@@ -3,6 +3,12 @@ package org.apache.dubbo.sample.tri.service;
 import org.apache.dubbo.common.stream.StreamObserver;
 
 public interface WrapGreeter {
+
+
+    String overload();
+
+
+    String overload(String param);
     /**
      * <pre>
      *  Sends a greeting
diff --git a/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/impl/WrapGreeterImpl.java b/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/impl/WrapGreeterImpl.java
index 9a0cc45..51aed64 100644
--- a/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/impl/WrapGreeterImpl.java
+++ b/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/service/impl/WrapGreeterImpl.java
@@ -7,6 +7,16 @@ import org.apache.dubbo.sample.tri.service.WrapGreeter;
 
 public class WrapGreeterImpl implements WrapGreeter {
     @Override
+    public String overload() {
+        return "overload";
+    }
+
+    @Override
+    public String overload(String param) {
+        return param;
+    }
+
+    @Override
     public String sayHelloLong(int len) {
         StringBuilder respBuilder = new StringBuilder();
         if (len > 0) {
@@ -53,7 +63,7 @@ public class WrapGreeterImpl implements WrapGreeter {
             @Override
             public void onNext(String data) {
                 System.out.println(data);
-                response.onNext("hello,"+data);
+                response.onNext("hello," + data);
             }
 
             @Override
diff --git a/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriWrapConsumerTest.java b/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriWrapConsumerTest.java
index e26e2dc..d66621a 100644
--- a/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriWrapConsumerTest.java
+++ b/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriWrapConsumerTest.java
@@ -21,6 +21,13 @@ public abstract class BaseTriWrapConsumerTest {
 
     protected static DubboBootstrap appDubboBootstrap;
 
+    @Test
+    public void overload() {
+        String ret = delegate.overload();
+        Assert.assertEquals(ret, "overload");
+        String ret2 = delegate.overload("overload");
+        Assert.assertEquals(ret2, "overload");
+    }
 
     @Test
     public void sayHelloUnaryRequestVoid() {
@@ -60,7 +67,8 @@ public abstract class BaseTriWrapConsumerTest {
     public void sayHelloStream() throws InterruptedException {
         int n = 10;
         CountDownLatch latch = new CountDownLatch(n);
-        final StreamObserver<String> request = delegate.sayHelloStream(new StdoutStreamObserver<String>("sayHelloStream") {
+        final StreamObserver<String> request = delegate.sayHelloStream(new StdoutStreamObserver<String>(
+                "sayHelloStream") {
             @Override
             public void onNext(String data) {
                 super.onNext(data);

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