diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java index b2f22390f6d..09d62cc067c 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java @@ -38,12 +38,11 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; public class GenericServiceTest { @@ -108,20 +107,20 @@ public void testGenericComplexCompute4FullServiceMetadata() { FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(DemoService.class); MethodDefinition methodDefinition = getMethod("complexCompute", fullServiceDefinition.getMethods()); - Map parm2= createComplextObject(fullServiceDefinition,var1, var2, l, var3, var4, testEnum); - ComplexObject complexObject = map2bean(parm2); + Map mapObject = createComplexObject(fullServiceDefinition,var1, var2, l, var3, var4, testEnum); + ComplexObject complexObject = map2bean(mapObject); Invoker invoker = protocol.refer(GenericService.class, url); GenericService client = proxyFactory.getProxy(invoker, true); - Object result = client.$invoke(methodDefinition.getName(), methodDefinition.getParameterTypes(), new Object[]{"haha", parm2}); + Object result = client.$invoke(methodDefinition.getName(), methodDefinition.getParameterTypes(), new Object[]{"haha", mapObject}); Assertions.assertEquals("haha###" + complexObject.toString(), result); Invoker invoker2 = protocol.refer(DemoService.class, url); GenericService client2 = (GenericService) proxyFactory.getProxy(invoker2, true); - Object result2 = client2.$invoke("complexCompute", methodDefinition.getParameterTypes(), new Object[]{"haha2", parm2}); + Object result2 = client2.$invoke("complexCompute", methodDefinition.getParameterTypes(), new Object[]{"haha2", mapObject}); Assertions.assertEquals("haha2###" + complexObject.toString(), result2); invoker.destroy(); @@ -167,7 +166,7 @@ MethodDefinition getMethod(String methodName, List list) { return null; } - Map createComplextObject(FullServiceDefinition fullServiceDefinition, String var1, int var2, long l, String[] var3, List var4, ComplexObject.TestEnum testEnum) { + Map createComplexObject(FullServiceDefinition fullServiceDefinition, String var1, int var2, long l, String[] var3, List var4, ComplexObject.TestEnum testEnum) { List typeDefinitions = fullServiceDefinition.getTypes(); TypeDefinition topTypeDefinition = null; TypeDefinition innerTypeDefinition = null; @@ -191,7 +190,7 @@ Map createComplextObject(FullServiceDefinition fullServiceDefini Assertions.assertEquals(topTypeDefinition.getProperties().get("strArrays").getType(), "java.lang.String[]"); Assertions.assertEquals(topTypeDefinition.getProperties().get("innerObject3").getType(), "org.apache.dubbo.service.ComplexObject.InnerObject3[]"); Assertions.assertEquals(topTypeDefinition.getProperties().get("testEnum").getType(), "org.apache.dubbo.service.ComplexObject.TestEnum"); - Assertions.assertEquals(topTypeDefinition.getProperties().get("innerObject2").getType(), "java.util.Set"); + Assertions.assertEquals(topTypeDefinition.getProperties().get("innerObject2").getType(), "java.util.List"); Assertions.assertSame(innerTypeDefinition.getProperties().get("innerA").getType(), "java.lang.String"); Assertions.assertSame(innerTypeDefinition.getProperties().get("innerB").getType(), "int"); @@ -216,16 +215,16 @@ Map createComplextObject(FullServiceDefinition fullServiceDefini innerObjectMap.put("innerA", var1); innerObjectMap.put("innerB", var2); - Set innerObject2Set = new HashSet<>(4); - result.put("innerObject2", innerObject2Set); + List innerObject2List = new ArrayList<>(); + result.put("innerObject2", innerObject2List); Map innerObject2Tmp1 = new HashMap<>(4); innerObject2Tmp1.put("innerA2", var1 + "_21"); innerObject2Tmp1.put("innerB2", var2 + 100000); Map innerObject2Tmp2 = new HashMap<>(4); innerObject2Tmp2.put("innerA2", var1 + "_22"); innerObject2Tmp2.put("innerB2", var2 + 200000); - innerObject2Set.add(innerObject2Tmp1); - innerObject2Set.add(innerObject2Tmp2); + innerObject2List.add(innerObject2Tmp1); + innerObject2List.add(innerObject2Tmp2); Map innerObject3Tmp1 = new HashMap<>(4); innerObject3Tmp1.put("innerA3", var1 + "_31"); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java index 5c895380302..3657a03a289 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java @@ -16,13 +16,12 @@ */ package org.apache.dubbo.service; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Set; /** * ON 2018/11/5 @@ -46,7 +45,7 @@ public ComplexObject(String var1, int var2, long l, String[] var3, List InnerObject2 io22 = new InnerObject2(); io22.setInnerA2(var1 + "_22"); io22.setInnerB2(var2 + 200000); - this.setInnerObject2(new HashSet(Arrays.asList(io21, io22))); + this.setInnerObject2(new ArrayList<>(Arrays.asList(io21, io22))); InnerObject3 io31 = new InnerObject3(); io31.setInnerA3(var1 + "_31"); @@ -61,7 +60,7 @@ public ComplexObject(String var1, int var2, long l, String[] var3, List } private InnerObject innerObject; - private Set innerObject2; + private List innerObject2; private InnerObject3[] innerObject3; private String[] strArrays; private List intList; @@ -109,11 +108,11 @@ public void setTestEnum(TestEnum testEnum) { this.testEnum = testEnum; } - public Set getInnerObject2() { + public List getInnerObject2() { return innerObject2; } - public void setInnerObject2(Set innerObject2) { + public void setInnerObject2(List innerObject2) { this.innerObject2 = innerObject2; } @@ -225,7 +224,7 @@ public String getInnerA2() { return innerA2; } - public void setInnerA2(String innerA) { + public void setInnerA2(String innerA2) { this.innerA2 = innerA2; } @@ -233,7 +232,7 @@ public int getInnerB2() { return innerB2; } - public void setInnerB2(int innerB) { + public void setInnerB2(int innerB2) { this.innerB2 = innerB2; } diff --git a/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java b/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java index 60a467a75b2..2859a13be8c 100644 --- a/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java +++ b/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java @@ -225,7 +225,7 @@ public String getInnerA2() { return innerA2; } - public void setInnerA2(String innerA) { + public void setInnerA2(String innerA2) { this.innerA2 = innerA2; } @@ -233,7 +233,7 @@ public int getInnerB2() { return innerB2; } - public void setInnerB2(int innerB) { + public void setInnerB2(int innerB2) { this.innerB2 = innerB2; }