You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2021/02/25 00:54:04 UTC

[servicecomb-java-chassis] branch master updated (1ae0b6b -> 78a48dd)

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

liubao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git.


    from 1ae0b6b  [SCB-2193] dynamic enum can indicate value is static or dynamic (#2248)
     new 2b143d2  [#2243]add examples for this issue
     new 78a48dd  [SCB-2194]upgrade netty from 4.1.47 to 4.1.59

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../zeroconfig/client/ClientServerEndpoint.java    | 23 ++++++++++++++++++
 .../{IServerEndpoint.java => IRpcEndpoint.java}    |  8 +++++--
 .../demo/zeroconfig/server/RpcEndpoint.java}       | 18 ++++++++------
 .../demo/zeroconfig/tests/ServerTest.java          | 28 ++++++++++++++++++++++
 dependencies/default/pom.xml                       |  2 +-
 5 files changed, 69 insertions(+), 10 deletions(-)
 copy demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/{IServerEndpoint.java => IRpcEndpoint.java} (84%)
 copy demo/{demo-pojo/pojo-server/src/main/java/org/apache/servicecomb/demo/pojo/server/FlowControlClientSchema.java => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/server/RpcEndpoint.java} (70%)


[servicecomb-java-chassis] 02/02: [SCB-2194]upgrade netty from 4.1.47 to 4.1.59

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 78a48dd30ea3860d0f2c0ffe367d2d16422709d3
Author: liubao <bi...@qq.com>
AuthorDate: Wed Feb 24 16:51:20 2021 +0800

    [SCB-2194]upgrade netty from 4.1.47 to 4.1.59
---
 dependencies/default/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml
index 11d139e..b5675b1 100644
--- a/dependencies/default/pom.xml
+++ b/dependencies/default/pom.xml
@@ -80,7 +80,7 @@
     <mock-server.version>3.10.4</mock-server.version>
     <narayana.version>5.3.2.Final</narayana.version>
     <netflix-commons.version>0.3.0</netflix-commons.version>
-    <netty.version>4.1.47.Final</netty.version>
+    <netty.version>4.1.59.Final</netty.version>
     <okhttp3.version>3.14.2</okhttp3.version>
     <powermock.version>1.6.2</powermock.version>
     <prometheus.version>0.6.0</prometheus.version>


[servicecomb-java-chassis] 01/02: [#2243]add examples for this issue

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 2b143d2a37a7f134271c43afe8c9be589ca52354
Author: liubao <bi...@qq.com>
AuthorDate: Tue Feb 23 22:13:40 2021 +0800

    [#2243]add examples for this issue
---
 .../zeroconfig/client/ClientServerEndpoint.java    | 23 ++++++++++++++
 .../demo/zeroconfig/client/IRpcEndpoint.java       | 26 ++++++++++++++++
 .../demo/zeroconfig/server/RpcEndpoint.java        | 35 ++++++++++++++++++++++
 .../demo/zeroconfig/tests/ServerTest.java          | 28 +++++++++++++++++
 4 files changed, 112 insertions(+)

diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/ClientServerEndpoint.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/ClientServerEndpoint.java
index 4fe6eb1..f2fb732 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/ClientServerEndpoint.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/ClientServerEndpoint.java
@@ -27,12 +27,17 @@ import org.apache.servicecomb.provider.pojo.RpcReference;
 import org.apache.servicecomb.provider.rest.common.RestSchema;
 import org.apache.servicecomb.registry.DiscoveryManager;
 import org.apache.servicecomb.registry.api.registry.Microservice;
+import org.apache.servicecomb.swagger.extend.annotations.RawJsonRequestBody;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import io.vertx.core.json.JsonObject;
+
 @RestSchema(schemaId = "ClientServerEndpoint")
 @RequestMapping(path = "/register/url/prefix", produces = MediaType.APPLICATION_JSON)
 public class ClientServerEndpoint {
@@ -42,6 +47,9 @@ public class ClientServerEndpoint {
   @RpcReference(microserviceName = "demo-zeroconfig-schemadiscovery-registry-server", schemaId = "ServerEndpoint")
   private IServerEndpoint serverEndpoint;
 
+  @RpcReference(microserviceName = "demo-zeroconfig-schemadiscovery-registry-server", schemaId = "RpcEndpoint")
+  private IRpcEndpoint rpcEndpoint;
+
   @GetMapping(path = "/getName")
   public String getName(@RequestParam(name = "name") String name) {
     return serverEndpoint.getName(name);
@@ -60,4 +68,19 @@ public class ClientServerEndpoint {
     }
     return names;
   }
+
+  @PostMapping(path = "/jsonObject")
+  public JsonObject jsonObject(@RequestBody JsonObject jsonObject) {
+    JsonObject param = new JsonObject();
+    param.put("map", jsonObject);
+    JsonObject message = rpcEndpoint.getJsonObject(param);
+    JsonObject inner = new JsonObject();
+    inner.put("map", message);
+    return inner;
+  }
+
+  @PostMapping(path = "/getString")
+  public String getString(@RawJsonRequestBody String jsonString) {
+    return jsonString;
+  }
 }
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/IRpcEndpoint.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/IRpcEndpoint.java
new file mode 100644
index 0000000..edbfc7f
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/client/IRpcEndpoint.java
@@ -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.
+ */
+
+package org.apache.servicecomb.demo.zeroconfig.client;
+
+import io.vertx.core.json.JsonObject;
+
+public interface IRpcEndpoint {
+  JsonObject getJsonObject(JsonObject message);
+
+  String getString(String message);
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/server/RpcEndpoint.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/server/RpcEndpoint.java
new file mode 100644
index 0000000..37dba61
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/server/RpcEndpoint.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.servicecomb.demo.zeroconfig.server;
+
+import org.apache.servicecomb.provider.pojo.RpcSchema;
+
+import io.vertx.core.json.JsonObject;
+
+@RpcSchema(schemaId = "RpcEndpoint")
+public class RpcEndpoint {
+  public JsonObject getJsonObject(JsonObject message) {
+    JsonObject inner = new JsonObject();
+    inner.put("map", message);
+    return inner;
+  }
+
+  public String getString(String message) {
+    return message;
+  }
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
index 1d906f5..21585d8 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-tests/src/main/java/org/apache/servicecomb/demo/zeroconfig/tests/ServerTest.java
@@ -26,6 +26,8 @@ import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
 
+import io.vertx.core.json.JsonObject;
+
 @Component
 public class ServerTest implements CategorizedTestCase {
 
@@ -35,6 +37,8 @@ public class ServerTest implements CategorizedTestCase {
   public void testRestTransport() throws Exception {
     testServerGetName();
     testGetAllMicroservice();
+    testJsonObject();
+    testString();
   }
 
   private void testServerGetName() throws Exception {
@@ -81,4 +85,28 @@ public class ServerTest implements CategorizedTestCase {
                 + "/register/url/prefix/getRegisteredMicroservice",
             List.class).size());
   }
+
+  private void testJsonObject() {
+    JsonObject in = new JsonObject();
+    JsonObject inner = new JsonObject();
+    //调用者需要按照swagger传参
+    inner.put("hello", "world");
+    in.put("map", inner);
+
+    JsonObject result = template
+        .postForObject(
+            "cse://demo-zeroconfig-schemadiscovery-registry-client"
+                + "/register/url/prefix/jsonObject", in, JsonObject.class);
+    TestMgr.check(inner.toString(), result.toString());
+    TestMgr.check(result.getString("hello"), "world");
+  }
+
+  private void testString() {
+    String in = "{\"hello\":\"world\"}";
+    String result = template
+        .postForObject(
+            "cse://demo-zeroconfig-schemadiscovery-registry-client"
+                + "/register/url/prefix/getString", in, String.class);
+    TestMgr.check(in, result);
+  }
 }