//public Xtruct testMultiException(string arg0, string arg1) //{ // Console.WriteLine("testMultiException:" + arg0 + " " + arg1 + " "); // Xtruct info = new Xtruct() // { // String_thing = arg0 + arg1 // }; // return info; //} public void testNest(Xtruct2 thing) { GenericTree input1 = new GenericTree(); input1.setName("thing"); input1.setParamType(TypeEnum.SYNTHETIC_TYPE); input1.setThrfitType("STRUCT"); input1.setType("XStruct2"); GenericTree prop1 = new GenericTree(); prop1.setName("Byte_thing"); prop1.setParamType(TypeEnum.PRIMITIVE_TYPE); prop1.setThrfitType("SBYTE"); prop1.setParent(input1); GenericTree prop2 = new GenericTree(); prop2.setName("Xstruct_thing"); prop2.setParamType(TypeEnum.SYNTHETIC_TYPE); prop2.setThrfitType("STRUCT"); prop2.setType("XStruct"); GenericTree prop31 = new GenericTree(); prop31.setName("String_thing"); prop31.setParamType(TypeEnum.PRIMITIVE_TYPE); prop31.setThrfitType("STRING"); prop31.setParent(prop2); GenericTree prop32 = new GenericTree(); prop32.setName("Byte_thing"); prop32.setParamType(TypeEnum.PRIMITIVE_TYPE); prop32.setThrfitType("SBYTE"); prop32.setParent(prop2); GenericTree prop33 = new GenericTree(); prop33.setName("I32_thing"); prop33.setParamType(TypeEnum.PRIMITIVE_TYPE); prop33.setThrfitType("I32"); prop33.setParent(prop2); GenericTree prop34 = new GenericTree(); prop34.setName("I64_thing"); prop34.setParamType(TypeEnum.PRIMITIVE_TYPE); prop34.setThrfitType("I64"); prop34.setParent(prop2); prop2.setParent(input1); GenericTree prop3 = new GenericTree(); prop3.setName("I32_thing"); prop3.setParamType(TypeEnum.PRIMITIVE_TYPE); prop3.setThrfitType("I32"); prop3.setParent(input1); List <GenericTree> inputGenericTrees = new List <GenericTree> { input1 }; // 参数值 List <Object> inputVals = new List <object>(); Dictionary <string, object> xstruct2 = new Dictionary <string, object>(); xstruct2["Byte_thing"] = thing.Byte_thing; xstruct2["I32_thing"] = thing.I32_thing; xstruct2["Xstruct_thing"] = new Dictionary <string, object> { { "Byte_thing", thing.Struct_thing.Byte_thing } , { "String_thing", thing.Struct_thing.String_thing } , { "I32_thing", thing.Struct_thing.I32_thing } , { "I64_thing", thing.Struct_thing.I64_thing } }; inputVals.Add(xstruct2); string method = SERVICE_NAME + "testNest"; GenericNode genericNode = new GenericNode(); genericNode.setInputs(inputGenericTrees); genericNode.setMethodName(method); genericNode.setValues(inputVals); genericNode.setOutput(input1); object obj = genericAnalyser.syncProcess(protocol, genericNode); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(obj)); }
/* * public THashSet<int> testSet(THashSet<int> thing) * { * Console.WriteLine("testSet:" + thing.ToString()); * * return thing; * } */ public void testStruct() { GenericTree input1 = new GenericTree(); input1.setName("thing"); input1.setParamType(TypeEnum.SYNTHETIC_TYPE); input1.setThrfitType("STRUCT"); input1.setType("Xtruct"); GenericTree prop1 = new GenericTree(); prop1.setName("String_thing"); prop1.setParamType(TypeEnum.PRIMITIVE_TYPE); prop1.setThrfitType("STRING"); GenericTree prop2 = new GenericTree(); prop2.setName("Byte_thing"); prop2.setParamType(TypeEnum.PRIMITIVE_TYPE); prop2.setThrfitType("SBYTE"); GenericTree prop3 = new GenericTree(); prop3.setName("I32_thing"); prop3.setParamType(TypeEnum.PRIMITIVE_TYPE); prop3.setThrfitType("I32"); GenericTree prop4 = new GenericTree(); prop4.setName("I64_thing"); prop4.setParamType(TypeEnum.PRIMITIVE_TYPE); prop4.setThrfitType("I64"); Dictionary <string, GenericTree> children = new Dictionary <string, GenericTree>(); children.Add("String_thing", prop1); children.Add("Byte_thing", prop2); children.Add("I32_thing", prop3); children.Add("I64_thing", prop4); input1.setChildren(children); List <GenericTree> inputGenericTrees = new List <GenericTree> { input1 }; GenericTree input2 = new GenericTree(); input2.setName("thing"); input2.setParamType(TypeEnum.SYNTHETIC_TYPE); input2.setThrfitType("STRUCT"); input2.setType("Xtruct"); GenericTree prop11 = new GenericTree(); prop11.setName("String_thing"); prop11.setParamType(TypeEnum.PRIMITIVE_TYPE); prop11.setThrfitType("STRING"); prop11.setParent(input2); GenericTree prop12 = new GenericTree(); prop12.setName("Byte_thing"); prop12.setParamType(TypeEnum.PRIMITIVE_TYPE); prop12.setThrfitType("SBYTE"); GenericTree prop13 = new GenericTree(); prop13.setName("I32_thing"); prop13.setParamType(TypeEnum.PRIMITIVE_TYPE); prop13.setThrfitType("I32"); GenericTree prop14 = new GenericTree(); prop14.setName("I64_thing"); prop14.setParamType(TypeEnum.PRIMITIVE_TYPE); prop14.setThrfitType("I64"); Dictionary <string, GenericTree> children2 = new Dictionary <string, GenericTree>(); children2.Add("String_thing", prop11); children2.Add("Byte_thing", prop12); children2.Add("I32_thing", prop13); children2.Add("I64_thing", prop14); input2.setChildren(children2); // 参数值 List <Object> inputVals = new List <object>(); Dictionary <string, object> row = new Dictionary <string, object>(); row.Add("String_thing", "stringValue3"); row.Add("Byte_thing", Convert.ToSByte(127)); row.Add("I32_thing", 99999); row.Add("I64_thing", 9999900001111); inputVals.Add(row); //出参 string method = SERVICE_NAME + "testStruct"; GenericNode genericNode = new GenericNode(); genericNode.setInputs(inputGenericTrees); genericNode.setMethodName(method); genericNode.setValues(inputVals); genericNode.setOutput(input2); object obj = genericAnalyser.syncProcess(protocol, genericNode); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(obj)); }
public void testMulti(sbyte arg0, int arg1, long arg2, Dictionary <short, string> arg3, Numberz arg4, long arg5) { // 返回 Xtruct GenericTree _arg0 = new GenericTree(); _arg0.setName("arg0"); _arg0.setParamType(TypeEnum.PRIMITIVE_TYPE); _arg0.setThrfitType("SBYTE"); GenericTree _arg1 = new GenericTree(); _arg1.setName("_arg1"); _arg1.setParamType(TypeEnum.PRIMITIVE_TYPE); _arg1.setThrfitType("I32"); GenericTree _arg2 = new GenericTree(); _arg2.setName("_arg2"); _arg2.setParamType(TypeEnum.PRIMITIVE_TYPE); _arg2.setThrfitType("I64"); GenericTree _arg3 = new GenericTree(); _arg3.setName("_arg3"); _arg3.setParamType(TypeEnum.COLLECTION_TYPE); _arg3.setThrfitType("MAP"); GenericTree innerKey = new GenericTree(); innerKey.setName("innerKey"); innerKey.setParamType(TypeEnum.PRIMITIVE_TYPE); innerKey.setThrfitType("I16"); GenericTree innerValue = new GenericTree(); innerValue.setName("innerValue"); innerValue.setParamType(TypeEnum.PRIMITIVE_TYPE); innerValue.setThrfitType("STRING"); Dictionary <string, GenericTree> children = new Dictionary <string, GenericTree>(); children.Add(TGenericClient.PARAMINFO_COLLECTION_MAP_KEY, innerKey); children.Add(TGenericClient.PARAMINFO_COLLECTION_MAP_VALUE, innerValue); _arg3.setChildren(children); GenericTree _arg4 = new GenericTree(); _arg4.setName("_arg4"); _arg4.setParamType(TypeEnum.PRIMITIVE_TYPE); _arg4.setThrfitType("I32"); GenericTree _arg5 = new GenericTree(); _arg5.setName("_arg5"); _arg5.setParamType(TypeEnum.PRIMITIVE_TYPE); _arg5.setThrfitType("I64"); List <GenericTree> inputGenericTrees = new List <GenericTree> { _arg0, _arg1, _arg2, _arg3, _arg4, _arg5 }; GenericTree input2 = new GenericTree(); input2.setName("thing"); input2.setParamType(TypeEnum.SYNTHETIC_TYPE); input2.setThrfitType("STRUCT"); input2.setType("Xtruct"); GenericTree prop11 = new GenericTree(); prop11.setName("String_thing"); prop11.setParamType(TypeEnum.PRIMITIVE_TYPE); prop11.setThrfitType("STRING"); prop11.setParent(input2); GenericTree prop12 = new GenericTree(); prop12.setName("Byte_thing"); prop12.setParamType(TypeEnum.PRIMITIVE_TYPE); prop12.setThrfitType("SBYTE"); prop12.setParent(input2); GenericTree prop13 = new GenericTree(); prop13.setName("I32_thing"); prop13.setParamType(TypeEnum.PRIMITIVE_TYPE); prop13.setThrfitType("I32"); prop13.setParent(input2); GenericTree prop14 = new GenericTree(); prop14.setName("I64_thing"); prop14.setParamType(TypeEnum.PRIMITIVE_TYPE); prop14.setThrfitType("I64"); prop14.setParent(input2); // 参数值 List <Object> inputVals = new List <object>(); inputVals.Add(arg0); inputVals.Add(arg1); inputVals.Add(arg2); inputVals.Add(arg3); inputVals.Add(arg4); inputVals.Add(arg5); //出参 string method = SERVICE_NAME + "testMulti"; GenericNode genericNode = new GenericNode(); genericNode.setInputs(inputGenericTrees); genericNode.setMethodName(method); genericNode.setValues(inputVals); genericNode.setOutput(input2); object obj = genericAnalyser.syncProcess(protocol, genericNode); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(obj)); }