go to java list and array (#265)
diff --git a/output/output.go b/output/output.go
index 65082ca..f619a1a 100644
--- a/output/output.go
+++ b/output/output.go
@@ -40,6 +40,8 @@
funcMap["Java8TimeYear"] = testfuncs.Java8TimeYear
funcMap["Java8LocalDate"] = testfuncs.Java8LocalDate
funcMap["JavaException"] = testfuncs.JavaException
+ funcMap["UserArray"] = testfuncs.UserArray
+ funcMap["UserList"] = testfuncs.UserList
}
func main() {
diff --git a/output/testfuncs/list.go b/output/testfuncs/list.go
new file mode 100644
index 0000000..c9084f3
--- /dev/null
+++ b/output/testfuncs/list.go
@@ -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 testfuncs
+
+import (
+ hessian "github.com/apache/dubbo-go-hessian2"
+)
+
+func UserArray() []byte {
+ e := hessian.NewEncoder()
+ _ = e.Encode([]*User{
+ {"wongoo"}, {"alex"},
+ })
+ return e.Buffer()
+}
+
+func UserList() []byte {
+ e := hessian.NewEncoder()
+ _ = e.Encode([]interface{}{
+ &User{"wongoo"}, &User{"alex"},
+ })
+ return e.Buffer()
+}
diff --git a/output/testfuncs/user.go b/output/testfuncs/user.go
new file mode 100644
index 0000000..03bb7df
--- /dev/null
+++ b/output/testfuncs/user.go
@@ -0,0 +1,33 @@
+/*
+ * 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 testfuncs
+
+import hessian "github.com/apache/dubbo-go-hessian2"
+
+type User struct {
+ Name string
+}
+
+// JavaClassName java fully qualified path
+func (*User) JavaClassName() string {
+ return "test.model.User"
+}
+
+func init() {
+ hessian.RegisterPOJO(&User{})
+}
diff --git a/test_hessian/src/main/java/test/model/User.java b/test_hessian/src/main/java/test/model/User.java
new file mode 100644
index 0000000..a9f5e52
--- /dev/null
+++ b/test_hessian/src/main/java/test/model/User.java
@@ -0,0 +1,46 @@
+/*
+ * 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 test.model;
+
+import java.io.Serializable;
+
+public class User implements Serializable {
+ private String name;
+
+ public User() {
+ }
+
+ public User(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return "User{" +
+ "name='" + name + '\'' +
+ '}';
+ }
+}
diff --git a/test_hessian/src/test/java/unit/GoUserListTest.java b/test_hessian/src/test/java/unit/GoUserListTest.java
new file mode 100644
index 0000000..394a77e
--- /dev/null
+++ b/test_hessian/src/test/java/unit/GoUserListTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 unit;
+
+
+import org.junit.Test;
+import test.model.User;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author wongoo
+ */
+public class GoUserListTest {
+
+ @Test
+ public void testUserList() {
+ User[] userArray = (User[]) GoTestUtil.readGoObject("UserArray");
+ System.out.println(Arrays.toString(userArray));
+
+ List<User> userList = (List<User>) GoTestUtil.readGoObject("UserList");
+ System.out.println(userList);
+ }
+}