This is an automated email from the ASF dual-hosted git repository.
earthchen 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 89229dc6 fix dubbo issue 11161 (#703)
89229dc6 is described below
commit 89229dc61f12b6344c82de3e6043c73293a750c1
Author: earthchen <[email protected]>
AuthorDate: Sun Feb 5 10:01:17 2023 +0800
fix dubbo issue 11161 (#703)
* fix dubbo issue 11161
* bump dubbo version to 3.1.5
* fix checkstyle
* fix
---
3-extensions/protocol/dubbo-samples-triple/pom.xml | 2 +-
.../org/apache/dubbo/sample/tri/api/ChildPojo.java | 38 ++++++++++++++++
.../apache/dubbo/sample/tri/api/ParentPojo.java | 51 ++++++++++++++++++++++
.../apache/dubbo/sample/tri/api/PojoGreeter.java | 3 ++
.../dubbo/sample/tri/pojo/PojoGreeterImpl.java | 14 +++++-
.../dubbo/sample/tri/pojo/TriPojoClient.java | 1 -
.../dubbo/sample/tri/BaseTriPojoClientTest.java | 11 ++++-
7 files changed, 115 insertions(+), 5 deletions(-)
diff --git a/3-extensions/protocol/dubbo-samples-triple/pom.xml
b/3-extensions/protocol/dubbo-samples-triple/pom.xml
index 3f1c7b2d..ffc730f0 100644
--- a/3-extensions/protocol/dubbo-samples-triple/pom.xml
+++ b/3-extensions/protocol/dubbo-samples-triple/pom.xml
@@ -37,7 +37,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.1.1</dubbo.version>
+ <dubbo.version>3.1.5</dubbo.version>
<grpc.version>1.44.1</grpc.version>
<junit.version>4.13.1</junit.version>
<spring-test.version>4.3.29.RELEASE</spring-test.version>
diff --git
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/ChildPojo.java
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/ChildPojo.java
new file mode 100644
index 00000000..ce2ecee6
--- /dev/null
+++
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/ChildPojo.java
@@ -0,0 +1,38 @@
+/*
+ * 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.sample.tri.api;
+
+public class ChildPojo extends ParentPojo {
+
+ private String child;
+
+ public String getChild() {
+ return child;
+ }
+
+ public void setChild(String child) {
+ this.child = child;
+ }
+
+ @Override
+ public String toString() {
+ return "ChildPojo{" +
+ "child='" + child + '\'' +
+ "} " + super.toString();
+ }
+}
diff --git
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/ParentPojo.java
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/ParentPojo.java
new file mode 100644
index 00000000..d05f2529
--- /dev/null
+++
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/ParentPojo.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sample.tri.api;
+
+import java.io.Serializable;
+
+public class ParentPojo implements Serializable {
+
+ private String parent;
+
+ private Byte byte1;
+
+ public Byte getByte1() {
+ return byte1;
+ }
+
+ public void setByte1(Byte byte1) {
+ this.byte1 = byte1;
+ }
+
+ public String getParent() {
+ return parent;
+ }
+
+ public void setParent(String parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public String toString() {
+ return "ParentPojo{" +
+ "parent='" + parent + '\'' +
+ ", byte1=" + byte1 +
+ '}';
+ }
+}
diff --git
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/PojoGreeter.java
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/PojoGreeter.java
index 744a60e2..eeb05edd 100644
---
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/PojoGreeter.java
+++
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/api/PojoGreeter.java
@@ -24,6 +24,9 @@ import org.apache.dubbo.common.stream.StreamObserver;
*/
public interface PojoGreeter {
+
+ ParentPojo greetChildPojo(Byte test);
+
String overload();
String overload(String param);
diff --git
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/PojoGreeterImpl.java
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/PojoGreeterImpl.java
index 5f32a5ad..e6d6f182 100644
---
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/PojoGreeterImpl.java
+++
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/PojoGreeterImpl.java
@@ -20,10 +20,11 @@ package org.apache.dubbo.sample.tri.pojo;
import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.rpc.RpcContext;
import org.apache.dubbo.sample.tri.Greeter;
+import org.apache.dubbo.sample.tri.api.ChildPojo;
+import org.apache.dubbo.sample.tri.api.ParentPojo;
import org.apache.dubbo.sample.tri.api.PojoGreeter;
import org.apache.dubbo.sample.tri.stub.GreeterImpl;
import org.apache.dubbo.sample.tri.util.EchoStreamObserver;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,6 +36,15 @@ public class PojoGreeterImpl implements PojoGreeter {
this.delegate = new GreeterImpl("tri-wrap");
}
+ @Override
+ public ParentPojo greetChildPojo(Byte test) {
+ ChildPojo childPojo = new ChildPojo();
+ childPojo.setChild("test");
+ childPojo.setParent("test");
+ childPojo.setByte1(test);
+ return childPojo;
+ }
+
@Override
public String overload() {
return "overload";
@@ -79,7 +89,7 @@ public class PojoGreeterImpl implements PojoGreeter {
@Override
public String greetWithAttachment(String request) {
- LOGGER.info("{} Received request attachments:{}",
"",RpcContext.getServerAttachment().getObjectAttachments());
+ LOGGER.info("{} Received request attachments:{}", "",
RpcContext.getServerAttachment().getObjectAttachments());
RpcContext.getServerContext().setAttachment("str", "str")
.setAttachment("integer", 1)
.setAttachment("raw", new byte[]{1, 2, 3, 4});
diff --git
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/TriPojoClient.java
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/TriPojoClient.java
index 07633b6f..1ba23a27 100644
---
a/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/TriPojoClient.java
+++
b/3-extensions/protocol/dubbo-samples-triple/src/main/java/org/apache/dubbo/sample/tri/pojo/TriPojoClient.java
@@ -26,7 +26,6 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.sample.tri.api.PojoGreeter;
import org.apache.dubbo.sample.tri.util.StdoutStreamObserver;
import org.apache.dubbo.sample.tri.util.TriSampleConstants;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/3-extensions/protocol/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriPojoClientTest.java
b/3-extensions/protocol/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriPojoClientTest.java
index 9bde6424..9b9806bb 100644
---
a/3-extensions/protocol/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriPojoClientTest.java
+++
b/3-extensions/protocol/dubbo-samples-triple/src/test/java/org/apache/dubbo/sample/tri/BaseTriPojoClientTest.java
@@ -21,9 +21,9 @@ import org.apache.dubbo.common.Version;
import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.sample.tri.api.ParentPojo;
import org.apache.dubbo.sample.tri.api.PojoGreeter;
import org.apache.dubbo.sample.tri.util.StdoutStreamObserver;
-
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
@@ -67,6 +67,15 @@ public abstract class BaseTriPojoClientTest {
Assert.assertEquals("hello,unary", delegate.greet("unary"));
}
+ @Test
+ public void greetChildPojo() {
+ Byte byte1 = Byte.valueOf("1");
+
+ ParentPojo childPojo = delegate.greetChildPojo(byte1);
+
+ Assert.assertEquals(byte1, childPojo.getByte1());
+ }
+
@Test
public void greetException() {
boolean isSupportSelfDefineException =
Version.getVersion().compareTo("3.2.0") < 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]