Repository: incubator-juneau
Updated Branches:
  refs/heads/master b58e236ab -> 62641ca77


Interface proxy tests.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/62641ca7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/62641ca7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/62641ca7

Branch: refs/heads/master
Commit: 62641ca775d8b434cad5d6e984dad21c45125164
Parents: b58e236
Author: JamesBognar <[email protected]>
Authored: Tue Mar 28 15:06:38 2017 -0400
Committer: JamesBognar <[email protected]>
Committed: Tue Mar 28 15:06:38 2017 -0400

----------------------------------------------------------------------
 .../apache/juneau/rest/test/InterfaceProxy.java |  70 ++++++-
 .../rest/test/InterfaceProxyResource.java       | 156 ++++++++++++++++
 .../juneau/rest/test/InterfaceProxyTest.java    | 183 +++++++++++++++++++
 3 files changed, 408 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/62641ca7/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
 
b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
index 7420516..ccafb08 100644
--- 
a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
+++ 
b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxy.java
@@ -28,6 +28,8 @@ public interface InterfaceProxy {
        
//--------------------------------------------------------------------------------
        // Test return types.
        
//--------------------------------------------------------------------------------
+
+       // Various primitives
        void returnVoid();
        int returnInt();
        Integer returnInteger();
@@ -44,6 +46,8 @@ public interface InterfaceProxy {
        List<Integer[][][]> returnInteger1d3dList();
        List<int[][][]> returnInt1d3dList();
        List<String> returnStringList();
+
+       // Beans
        Bean returnBean();
        Bean[][][] returnBean3dArray();
        List<Bean> returnBeanList();
@@ -52,20 +56,41 @@ public interface InterfaceProxy {
        Map<String,List<Bean>> returnBeanListMap();
        Map<String,List<Bean[][][]>> returnBean1d3dListMap();
        Map<Integer,List<Bean>> returnBeanListMapIntegerKeys();
+
+       // Swapped POJOs
        SwappedPojo returnSwappedPojo();
        SwappedPojo[][][] returnSwappedPojo3dArray();
        Map<SwappedPojo,SwappedPojo> returnSwappedPojoMap();
        Map<SwappedPojo,SwappedPojo[][][]> returnSwappedPojo3dMap();
 
+       // Implicit swapped POJOs
+       ImplicitSwappedPojo returnImplicitSwappedPojo();
+       ImplicitSwappedPojo[][][] returnImplicitSwappedPojo3dArray();
+       Map<ImplicitSwappedPojo,ImplicitSwappedPojo> 
returnImplicitSwappedPojoMap();
+       Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> 
returnImplicitSwappedPojo3dMap();
+
+       // Enums
+       TestEnum returnEnum();
+       TestEnum[][][] returnEnum3d();
+       List<TestEnum> returnEnumList();
+       List<List<List<TestEnum>>> returnEnum3dList();
+       List<TestEnum[][][]> returnEnum1d3dList();
+       Map<TestEnum,TestEnum> returnEnumMap();
+       Map<TestEnum,TestEnum[][][]> returnEnum3dArrayMap();
+       Map<TestEnum,List<TestEnum[][][]>> returnEnum1d3dListMap();
+
        
//--------------------------------------------------------------------------------
        // Test server-side exception serialization.
        
//--------------------------------------------------------------------------------
+
        void throwException1() throws InterfaceProxyException1;
        void throwException2() throws InterfaceProxyException2;
 
        
//--------------------------------------------------------------------------------
-       // Test 1-arg parameters
+       // Test parameters
        
//--------------------------------------------------------------------------------
+
+       // Various primitives
        void setNothing();
        void setInt(int x);
        void setInteger(Integer x);
@@ -83,6 +108,8 @@ public interface InterfaceProxy {
        void setInteger1d3dList(List<Integer[][][]> x);
        void setInt1d3dList(List<int[][][]> x);
        void setStringList(List<String> x);
+
+       // Beans
        void setBean(Bean x);
        void setBean3dArray(Bean[][][] x);
        void setBeanList(List<Bean> x);
@@ -91,11 +118,33 @@ public interface InterfaceProxy {
        void setBeanListMap(Map<String,List<Bean>> x);
        void setBean1d3dListMap(Map<String,List<Bean[][][]>> x);
        void setBeanListMapIntegerKeys(Map<Integer,List<Bean>> x);
+
+       // Swapped POJOs
        void setSwappedPojo(SwappedPojo x);
        void setSwappedPojo3dArray(SwappedPojo[][][] x);
        void setSwappedPojoMap(Map<SwappedPojo,SwappedPojo> x);
        void setSwappedPojo3dMap(Map<SwappedPojo,SwappedPojo[][][]> x);
 
+       // Implicit swapped POJOs
+       void setImplicitSwappedPojo(ImplicitSwappedPojo x);
+       void setImplicitSwappedPojo3dArray(ImplicitSwappedPojo[][][] x);
+       void 
setImplicitSwappedPojoMap(Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x);
+       void 
setImplicitSwappedPojo3dMap(Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> 
x);
+
+       // Enums
+       void setEnum(TestEnum x);
+       void setEnum3d(TestEnum[][][] x);
+       void setEnumList(List<TestEnum> x);
+       void setEnum3dList(List<List<List<TestEnum>>> x);
+       void setEnum1d3dList(List<TestEnum[][][]> x);
+       void setEnumMap(Map<TestEnum,TestEnum> x);
+       void setEnum3dArrayMap(Map<TestEnum,TestEnum[][][]> x);
+       void setEnum1d3dListMap(Map<TestEnum,List<TestEnum[][][]>> x);
+
+       
//--------------------------------------------------------------------------------
+       // Helper classes
+       
//--------------------------------------------------------------------------------
+
        public static class Bean {
                public int a;
                public String b;
@@ -137,4 +186,23 @@ public interface InterfaceProxy {
                        return c;
                }
        }
+
+       @BeanIgnore
+       public static class ImplicitSwappedPojo {
+               public boolean wasUnswapped;
+               @Override
+               public String toString() {
+                       return "[{(<swapped>)}]";
+               }
+               public ImplicitSwappedPojo() {
+               }
+               public ImplicitSwappedPojo(String fromString) {
+                       if (fromString.equals("[{(<swapped>)}]"))
+                               wasUnswapped = true;
+               }
+       }
+
+       public static enum TestEnum {
+               ONE,TWO,THREE
+       }
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/62641ca7/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
 
b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
index f8f56e2..28e9ca5 100644
--- 
a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
+++ 
b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/InterfaceProxyResource.java
@@ -37,6 +37,12 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
        @RestMethod(name="PROXY", path="/proxy/*")
        public InterfaceProxy getProxy() {
                return new InterfaceProxy() {
+
+                       
//--------------------------------------------------------------------------------
+                       // Test return types.
+                       
//--------------------------------------------------------------------------------
+
+                       // Various primitives
                        @Override
                        public void returnVoid() {
                        }
@@ -106,6 +112,8 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
                        public List<String> returnStringList() {
                                return asList(new String[]{"foo","bar",null});
                        }
+
+                       // Beans
                        @Override
                        public Bean returnBean() {
                                return new Bean().init();
@@ -138,6 +146,8 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
                        public Map<Integer,List<Bean>> 
returnBeanListMapIntegerKeys() {
                                return new 
AMap<Integer,List<Bean>>().append(1,asList(new Bean().init()));
                        }
+
+                       // Swapped POJOs
                        @Override
                        public SwappedPojo returnSwappedPojo() {
                                return new SwappedPojo();
@@ -154,6 +164,71 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
                        public Map<SwappedPojo,SwappedPojo[][][]> 
returnSwappedPojo3dMap() {
                                return new 
AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new 
SwappedPojo[][][]{{{new SwappedPojo(),null},null},null});
                        }
+
+                       // Implicit swapped POJOs
+                       @Override
+                       public ImplicitSwappedPojo returnImplicitSwappedPojo() {
+                               return new ImplicitSwappedPojo();
+                       }
+                       @Override
+                       public ImplicitSwappedPojo[][][] 
returnImplicitSwappedPojo3dArray() {
+                               return new ImplicitSwappedPojo[][][]{{{new 
ImplicitSwappedPojo(),null},null},null};
+                       }
+                       @Override
+                       public Map<ImplicitSwappedPojo,ImplicitSwappedPojo> 
returnImplicitSwappedPojoMap() {
+                               return new 
AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new 
ImplicitSwappedPojo(), new ImplicitSwappedPojo());
+                       }
+                       @Override
+                       public 
Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> 
returnImplicitSwappedPojo3dMap() {
+                               return new 
AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new 
ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new 
ImplicitSwappedPojo(),null},null},null});
+                       }
+
+                       // Enums
+                       @Override
+                       public TestEnum returnEnum() {
+                               return TestEnum.TWO;
+                       }
+                       @Override
+                       public TestEnum[][][] returnEnum3d() {
+                               return new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null};
+                       }
+                       @Override
+                       public List<TestEnum> returnEnumList() {
+                               return new 
AList<TestEnum>().append(TestEnum.TWO).append(null);
+                       }
+                       @Override
+                       public List<List<List<TestEnum>>> returnEnum3dList() {
+                               return new AList<List<List<TestEnum>>>()
+                               .append(
+                                       new AList<List<TestEnum>>()
+                                       .append(
+                                               new 
AList<TestEnum>().append(TestEnum.TWO).append(null)
+                                       )
+                                       .append(null)
+                               .append(null)
+                               );
+                       }
+                       @Override
+                       public List<TestEnum[][][]> returnEnum1d3dList() {
+                               return new AList<TestEnum[][][]>().append(new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null);
+                       }
+                       @Override
+                       public Map<TestEnum,TestEnum> returnEnumMap() {
+                               return new 
AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO);
+                       }
+                       @Override
+                       public Map<TestEnum,TestEnum[][][]> 
returnEnum3dArrayMap() {
+                               return new 
AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null});
+                       }
+                       @Override
+                       public Map<TestEnum,List<TestEnum[][][]>> 
returnEnum1d3dListMap() {
+                               return new 
AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new 
AList<TestEnum[][][]>().append(new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null));
+                       }
+
+                       
//--------------------------------------------------------------------------------
+                       // Test server-side exception serialization.
+                       
//--------------------------------------------------------------------------------
+
                        @Override
                        public void throwException1() throws 
InterfaceProxy.InterfaceProxyException1 {
                                throw new 
InterfaceProxy.InterfaceProxyException1("foo");
@@ -162,6 +237,12 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
                        public void throwException2() throws 
InterfaceProxy.InterfaceProxyException2 {
                                throw new 
InterfaceProxy.InterfaceProxyException2();
                        }
+
+                       
//--------------------------------------------------------------------------------
+                       // Test parameters
+                       
//--------------------------------------------------------------------------------
+
+                       // Various primitives
                        @Override
                        public void setNothing() {
                        }
@@ -235,6 +316,8 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
                        public void setStringList(List<String> x) {
                                assertObjectEquals("['foo','bar',null]", x);
                        }
+
+                       // Beans
                        @Override
                        public void setBean(Bean x) {
                                assertObjectEquals("{a:1,b:'foo'}", x);
@@ -268,6 +351,8 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
                                assertObjectEquals("{'1':[{a:1,b:'foo'}]}", x); 
 // Note: JsonSerializer serializes key as string.
                                assertEquals(Integer.class, 
x.keySet().iterator().next().getClass());
                        }
+
+                       // Swapped POJOs
                        @Override
                        public void setSwappedPojo(SwappedPojo x) {
                                assertTrue(x.wasUnswapped);
@@ -291,6 +376,77 @@ public class InterfaceProxyResource extends 
RestServletJenaDefault {
                                assertTrue(e.getKey().wasUnswapped);
                                assertTrue(e.getValue()[0][0][0].wasUnswapped);
                        }
+
+                       // Implicit swapped POJOs
+                       @Override
+                       public void setImplicitSwappedPojo(ImplicitSwappedPojo 
x) {
+                               assertTrue(x.wasUnswapped);
+                       }
+                       @Override
+                       public void 
setImplicitSwappedPojo3dArray(ImplicitSwappedPojo[][][] x) {
+                               
assertObjectEquals("[[['[{(<swapped>)}]',null],null],null]", x);
+                               assertTrue(x[0][0][0].wasUnswapped);
+                       }
+                       @Override
+                       public void 
setImplicitSwappedPojoMap(Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x) {
+                               
assertObjectEquals("{'[{(<swapped>)}]':'[{(<swapped>)}]'}", x);
+                               
Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo> e = 
x.entrySet().iterator().next();
+                               assertTrue(e.getKey().wasUnswapped);
+                               assertTrue(e.getValue().wasUnswapped);
+                       }
+                       @Override
+                       public void 
setImplicitSwappedPojo3dMap(Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> 
x) {
+                               
assertObjectEquals("{'[{(<swapped>)}]':[[['[{(<swapped>)}]',null],null],null]}",
 x);
+                               
Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> e = 
x.entrySet().iterator().next();
+                               assertTrue(e.getKey().wasUnswapped);
+                               assertTrue(e.getValue()[0][0][0].wasUnswapped);
+                       }
+
+                       // Enums
+                       @Override
+                       public void setEnum(TestEnum x) {
+                               assertEquals(TestEnum.TWO, x);
+                       }
+                       @Override
+                       public void setEnum3d(TestEnum[][][] x) {
+                               
assertObjectEquals("[[['TWO',null],null],null]", x);
+                       }
+                       @Override
+                       public void setEnumList(List<TestEnum> x) {
+                               assertObjectEquals("['TWO',null]", x);
+                               assertEquals(TestEnum.class, 
x.get(0).getClass());
+                       }
+                       @Override
+                       public void setEnum3dList(List<List<List<TestEnum>>> x) 
{
+                               
assertObjectEquals("[[['TWO',null],null,null]]", x);
+                               assertEquals(TestEnum.class, 
x.get(0).get(0).get(0).getClass());
+                       }
+                       @Override
+                       public void setEnum1d3dList(List<TestEnum[][][]> x) {
+                               
assertObjectEquals("[[[['TWO',null],null],null],null]", x);
+                               assertEquals(TestEnum[][][].class, 
x.get(0).getClass());
+                       }
+                       @Override
+                       public void setEnumMap(Map<TestEnum,TestEnum> x) {
+                               assertObjectEquals("{ONE:'TWO'}", x);
+                               Map.Entry<TestEnum,TestEnum> e = 
x.entrySet().iterator().next();
+                               assertEquals(TestEnum.class, 
e.getKey().getClass());
+                               assertEquals(TestEnum.class, 
e.getValue().getClass());
+                       }
+                       @Override
+                       public void 
setEnum3dArrayMap(Map<TestEnum,TestEnum[][][]> x) {
+                               
assertObjectEquals("{ONE:[[['TWO',null],null],null]}", x);
+                               Map.Entry<TestEnum,TestEnum[][][]> e = 
x.entrySet().iterator().next();
+                               assertEquals(TestEnum.class, 
e.getKey().getClass());
+                               assertEquals(TestEnum[][][].class, 
e.getValue().getClass());
+                       }
+                       @Override
+                       public void 
setEnum1d3dListMap(Map<TestEnum,List<TestEnum[][][]>> x) {
+                               
assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", x);
+                               Map.Entry<TestEnum,List<TestEnum[][][]>> e = 
x.entrySet().iterator().next();
+                               assertEquals(TestEnum.class, 
e.getKey().getClass());
+                               assertEquals(TestEnum[][][].class, 
e.getValue().get(0).getClass());
+                       }
                };
        }
 

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/62641ca7/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
index 11a7fe0..b7b8261 100644
--- 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InterfaceProxyTest.java
@@ -60,6 +60,11 @@ public class InterfaceProxyTest extends RestTestcase {
                return getClient(serializer, 
parser).getRemoteableProxy(InterfaceProxy.class, 
"/testInterfaceProxyResource/proxy");
        }
 
+       
//--------------------------------------------------------------------------------
+       // Test return types.
+       
//--------------------------------------------------------------------------------
+
+       // Various primitives
        @Test
        public void returnVoid() {
                getProxy().returnVoid();
@@ -148,6 +153,7 @@ public class InterfaceProxyTest extends RestTestcase {
                assertObjectEquals("['foo','bar',null]", 
getProxy().returnStringList());
        }
 
+       // Beans
        @Test
        public void returnBean() {
                Bean x = getProxy().returnBean();
@@ -205,6 +211,7 @@ public class InterfaceProxyTest extends RestTestcase {
                assertEquals(Integer.class, 
x.keySet().iterator().next().getClass());
        }
 
+       // Swapped POJOs
        @Test
        public void returnSwappedPojo() {
                SwappedPojo x = getProxy().returnSwappedPojo();
@@ -237,6 +244,103 @@ public class InterfaceProxyTest extends RestTestcase {
                assertTrue(e.getValue()[0][0][0].wasUnswapped);
        }
 
+       // Implicit swapped POJOs
+       @Test
+       public void returnImplicitSwappedPojo() {
+               ImplicitSwappedPojo x = getProxy().returnImplicitSwappedPojo();
+               assertObjectEquals("'[{(<swapped>)}]'", x);
+               assertTrue(x.wasUnswapped);
+       }
+
+       @Test
+       public void returnImplicitSwappedPojo3dArray() {
+               ImplicitSwappedPojo[][][] x = 
getProxy().returnImplicitSwappedPojo3dArray();
+               assertObjectEquals("[[['[{(<swapped>)}]',null],null],null]", x);
+               assertTrue(x[0][0][0].wasUnswapped);
+       }
+
+       @Test
+       public void returnImplicitSwappedPojoMap() {
+               Map<ImplicitSwappedPojo,ImplicitSwappedPojo> x = 
getProxy().returnImplicitSwappedPojoMap();
+               assertObjectEquals("{'[{(<swapped>)}]':'[{(<swapped>)}]'}", x);
+               Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo> e = 
x.entrySet().iterator().next();
+               assertTrue(e.getKey().wasUnswapped);
+               assertTrue(e.getValue().wasUnswapped);
+       }
+
+       @Test
+       public void returnImplicitSwappedPojo3dMap() {
+               Map<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> x = 
getProxy().returnImplicitSwappedPojo3dMap();
+               
assertObjectEquals("{'[{(<swapped>)}]':[[['[{(<swapped>)}]',null],null],null]}",
 x);
+               Map.Entry<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]> e = 
x.entrySet().iterator().next();
+               assertTrue(e.getKey().wasUnswapped);
+               assertTrue(e.getValue()[0][0][0].wasUnswapped);
+       }
+
+       // Enums
+       @Test
+       public void returnEnum() {
+               TestEnum x = getProxy().returnEnum();
+               assertObjectEquals("'TWO'", x);
+       }
+
+       @Test
+       public void returnEnum3d() {
+               TestEnum[][][] x = getProxy().returnEnum3d();
+               assertObjectEquals("[[['TWO',null],null],null]", x);
+               assertEquals(TestEnum.class, x[0][0][0].getClass());
+       }
+
+       @Test
+       public void returnEnumList() {
+               List<TestEnum> x = getProxy().returnEnumList();
+               assertObjectEquals("['TWO',null]", x);
+               assertEquals(TestEnum.class, x.get(0).getClass());
+       }
+
+       @Test
+       public void returnEnum3dList() {
+               List<List<List<TestEnum>>> x = getProxy().returnEnum3dList();
+               assertObjectEquals("[[['TWO',null],null,null]]", x);
+               assertEquals(TestEnum.class, x.get(0).get(0).get(0).getClass());
+       }
+
+       @Test
+       public void returnEnum1d3dList() {
+               List<TestEnum[][][]> x = getProxy().returnEnum1d3dList();
+               assertObjectEquals("[[[['TWO',null],null],null],null]", x);
+               assertEquals(TestEnum[][][].class, x.get(0).getClass());
+       }
+
+       @Test
+       public void returnEnumMap() {
+               Map<TestEnum,TestEnum> x = getProxy().returnEnumMap();
+               assertObjectEquals("{ONE:'TWO'}", x);
+               Map.Entry<TestEnum,TestEnum> e = x.entrySet().iterator().next();
+               assertEquals(TestEnum.class, e.getKey().getClass());
+               assertEquals(TestEnum.class, e.getValue().getClass());
+       }
+
+       @Test
+       public void returnEnum3dArrayMap() {
+               Map<TestEnum,TestEnum[][][]> x = 
getProxy().returnEnum3dArrayMap();
+               assertObjectEquals("{ONE:[[['TWO',null],null],null]}", x);
+               Map.Entry<TestEnum,TestEnum[][][]> e = 
x.entrySet().iterator().next();
+               assertEquals(TestEnum.class, e.getKey().getClass());
+               assertEquals(TestEnum[][][].class, e.getValue().getClass());
+       }
+
+       @Test
+       public void returnEnum1d3dListMap() {
+               Map<TestEnum,List<TestEnum[][][]>> x = 
getProxy().returnEnum1d3dListMap();
+               assertObjectEquals("{ONE:[[[['TWO',null],null],null],null]}", 
x);
+               assertEquals(TestEnum[][][].class, 
x.get(TestEnum.ONE).get(0).getClass());
+       }
+
+       
//--------------------------------------------------------------------------------
+       // Test server-side exception serialization.
+       
//--------------------------------------------------------------------------------
+
        @Test
        public void throwException1() {
                try {
@@ -256,6 +360,11 @@ public class InterfaceProxyTest extends RestTestcase {
                }
        }
 
+       
//--------------------------------------------------------------------------------
+       // Test parameters
+       
//--------------------------------------------------------------------------------
+
+       // Various primitives
        @Test
        public void setNothing() {
                getProxy().setNothing();
@@ -374,6 +483,7 @@ public class InterfaceProxyTest extends RestTestcase {
                getProxy().setStringList(Arrays.asList("foo","bar",null));
        }
 
+       // Beans
        @Test
        public void setBean() {
                getProxy().setBean(new Bean().init());
@@ -399,6 +509,7 @@ public class InterfaceProxyTest extends RestTestcase {
                getProxy().setBeanListMapIntegerKeys(new 
AMap<Integer,List<Bean>>().append(1,Arrays.asList(new Bean().init())));
        }
 
+       // Swapped POJOs
        @Test
        public void setSwappedPojo() {
                getProxy().setSwappedPojo(new SwappedPojo());
@@ -418,4 +529,76 @@ public class InterfaceProxyTest extends RestTestcase {
        public void setSwappedPojo3dMap() {
                getProxy().setSwappedPojo3dMap(new 
AMap<SwappedPojo,SwappedPojo[][][]>().append(new SwappedPojo(), new 
SwappedPojo[][][]{{{new SwappedPojo(),null},null},null}));
        }
+
+       // Implicit swapped POJOs
+       @Test
+       public void setImplicitSwappedPojo() {
+               getProxy().setImplicitSwappedPojo(new ImplicitSwappedPojo());
+       }
+
+       @Test
+       public void setImplicitSwappedPojo3dArray() {
+               getProxy().setImplicitSwappedPojo3dArray(new 
ImplicitSwappedPojo[][][]{{{new ImplicitSwappedPojo(),null},null},null});
+       }
+
+       @Test
+       public void setImplicitSwappedPojoMap() {
+               getProxy().setImplicitSwappedPojoMap(new 
AMap<ImplicitSwappedPojo,ImplicitSwappedPojo>().append(new 
ImplicitSwappedPojo(), new ImplicitSwappedPojo()));
+       }
+
+       @Test
+       public void setImplicitSwappedPojo3dMap() {
+               getProxy().setImplicitSwappedPojo3dMap(new 
AMap<ImplicitSwappedPojo,ImplicitSwappedPojo[][][]>().append(new 
ImplicitSwappedPojo(), new ImplicitSwappedPojo[][][]{{{new 
ImplicitSwappedPojo(),null},null},null}));
+       }
+
+       // Enums
+       @Test
+       public void setEnum() {
+               getProxy().setEnum(TestEnum.TWO);
+       }
+
+       @Test
+       public void setEnum3d() {
+               getProxy().setEnum3d(new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null});
+       }
+
+       @Test
+       public void setEnumList() {
+               getProxy().setEnumList(new 
AList<TestEnum>().append(TestEnum.TWO).append(null));
+       }
+
+       @Test
+       public void setEnum3dList() {
+               getProxy().setEnum3dList(
+                       new AList<List<List<TestEnum>>>()
+                       .append(
+                               new AList<List<TestEnum>>()
+                               .append(
+                                       new 
AList<TestEnum>().append(TestEnum.TWO).append(null)
+                               )
+                               .append(null)
+                       .append(null)
+                       )
+               );
+       }
+
+       @Test
+       public void setEnum1d3dList() {
+               getProxy().setEnum1d3dList(new 
AList<TestEnum[][][]>().append(new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null));
+       }
+
+       @Test
+       public void setEnumMap() {
+               getProxy().setEnumMap(new 
AMap<TestEnum,TestEnum>().append(TestEnum.ONE,TestEnum.TWO));
+       }
+
+       @Test
+       public void setEnum3dArrayMap() {
+               getProxy().setEnum3dArrayMap(new 
AMap<TestEnum,TestEnum[][][]>().append(TestEnum.ONE, new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null}));
+       }
+
+       @Test
+       public void setEnum1d3dListMap() {
+               getProxy().setEnum1d3dListMap(new 
AMap<TestEnum,List<TestEnum[][][]>>().append(TestEnum.ONE, new 
AList<TestEnum[][][]>().append(new 
TestEnum[][][]{{{TestEnum.TWO,null},null},null}).append(null)));
+       }
 }

Reply via email to