You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by al...@apache.org on 2021/03/18 06:38:42 UTC

[dubbo-samples] branch master updated: improve local call sample (#290)

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 b11c267  improve local call sample (#290)
b11c267 is described below

commit b11c26715d7a0654a53db0064af40a0a50b8633a
Author: Gong Dewei <ky...@qq.com>
AuthorDate: Thu Mar 18 14:38:34 2021 +0800

    improve local call sample (#290)
---
 dubbo-samples-local/case-configuration.yml                  | 13 +++++++------
 .../java/org/apache/dubbo/samples/local/DemoServiceIT.java  |  5 ++++-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/dubbo-samples-local/case-configuration.yml b/dubbo-samples-local/case-configuration.yml
index 5eb95cd..b23ab56 100644
--- a/dubbo-samples-local/case-configuration.yml
+++ b/dubbo-samples-local/case-configuration.yml
@@ -14,10 +14,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from: app-builtin-zookeeper.yml
 
-props:
-  project_name: dubbo-samples-local
-  main_class: org.apache.dubbo.samples.local.LocalDemo
-  zookeeper_port: 2181
-  dubbo_port: 20880
+# local call through injvm, start test container only
+services:
+  dubbo-samples-local-test:
+    type: test
+    basedir: .
+    tests:
+      - "**/*IT.class"
\ No newline at end of file
diff --git a/dubbo-samples-local/src/test/java/org/apache/dubbo/samples/local/DemoServiceIT.java b/dubbo-samples-local/src/test/java/org/apache/dubbo/samples/local/DemoServiceIT.java
index 61cb87e..61479af 100644
--- a/dubbo-samples-local/src/test/java/org/apache/dubbo/samples/local/DemoServiceIT.java
+++ b/dubbo-samples-local/src/test/java/org/apache/dubbo/samples/local/DemoServiceIT.java
@@ -40,7 +40,10 @@ public class DemoServiceIT {
 
     @Test
     public void test() throws Exception {
-        Assert.assertTrue(demoService.sayHello("world").startsWith("Hello world"));
+        // see also: org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.doInvoke
+        // InjvmInvoker set remote address to 127.0.0.1:0
+        String result = demoService.sayHello("world");
+        Assert.assertEquals(result, "Hello world, response from provider: 127.0.0.1:0");
     }
 
 }


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