You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/11/26 16:45:07 UTC

svn commit: r1039425 - in /pivot/trunk/core/test/org/apache/pivot/json/test: BindTest.java TestBean2DictionarySubclass.java TestBean2ListSubclass.java TestBean2MapSubclass.java TestBean2SequenceSubclass.java

Author: gbrown
Date: Fri Nov 26 15:45:07 2010
New Revision: 1039425

URL: http://svn.apache.org/viewvc?rev=1039425&view=rev
Log:
Add unit test to make sure that subclasses of generic types are deserialized properly.

Added:
    pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2DictionarySubclass.java
    pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2ListSubclass.java
    pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2MapSubclass.java
    pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2SequenceSubclass.java
Modified:
    pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java

Modified: pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java?rev=1039425&r1=1039424&r2=1039425&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java Fri Nov 26 15:45:07 2010
@@ -81,7 +81,7 @@ public class BindTest {
         List<Object> list =
             (List<Object>)listSerializer.readObject(getClass().getResourceAsStream("list.json"));
 
-        JSONSerializer typedListSerializer = new JSONSerializer(TestBean2List.class);
+        JSONSerializer typedListSerializer = new JSONSerializer(TestBean2ListSubclass.class);
         TestBean2List typedList =
             (TestBean2List)typedListSerializer.readObject(getClass().getResourceAsStream("list.json"));
 
@@ -103,7 +103,7 @@ public class BindTest {
         List<Object> list =
             (List<Object>)listSerializer.readObject(getClass().getResourceAsStream("list.json"));
 
-        JSONSerializer sequenceSerializer = new JSONSerializer(TestBean2Sequence.class);
+        JSONSerializer sequenceSerializer = new JSONSerializer(TestBean2SequenceSubclass.class);
         TestBean2Sequence sequence =
             (TestBean2Sequence)sequenceSerializer.readObject(getClass().getResourceAsStream("list.json"));
 
@@ -153,7 +153,7 @@ public class BindTest {
      */
     @Test
     public void testMapSubclass() throws IOException, SerializationException {
-        JSONSerializer typedMapSerializer = new JSONSerializer(TestBean2Map.class);
+        JSONSerializer typedMapSerializer = new JSONSerializer(TestBean2MapSubclass.class);
 
         TestBean2Map map =
             (TestBean2Map)typedMapSerializer.readObject(new StringReader("{foo: {a:1, b:2, c:'3'}}"));
@@ -170,7 +170,7 @@ public class BindTest {
      */
     @Test
     public void testDictionary() throws IOException, SerializationException {
-        JSONSerializer dictionarySerializer = new JSONSerializer(TestBean2Dictionary.class);
+        JSONSerializer dictionarySerializer = new JSONSerializer(TestBean2DictionarySubclass.class);
 
         TestBean2Dictionary dictionary =
             (TestBean2Dictionary)dictionarySerializer.readObject(new StringReader("{foo: {a:1, b:2, c:'3'}}"));

Added: pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2DictionarySubclass.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2DictionarySubclass.java?rev=1039425&view=auto
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2DictionarySubclass.java (added)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2DictionarySubclass.java Fri Nov 26 15:45:07 2010
@@ -0,0 +1,21 @@
+/*
+ * 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.pivot.json.test;
+
+public class TestBean2DictionarySubclass extends TestBean2Dictionary {
+    private static final long serialVersionUID = 0;
+}

Added: pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2ListSubclass.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2ListSubclass.java?rev=1039425&view=auto
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2ListSubclass.java (added)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2ListSubclass.java Fri Nov 26 15:45:07 2010
@@ -0,0 +1,21 @@
+/*
+ * 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.pivot.json.test;
+
+public class TestBean2ListSubclass extends TestBean2List {
+    private static final long serialVersionUID = 0;
+}

Added: pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2MapSubclass.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2MapSubclass.java?rev=1039425&view=auto
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2MapSubclass.java (added)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2MapSubclass.java Fri Nov 26 15:45:07 2010
@@ -0,0 +1,21 @@
+/*
+ * 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.pivot.json.test;
+
+public class TestBean2MapSubclass extends TestBean2Map {
+    private static final long serialVersionUID = 0;
+}

Added: pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2SequenceSubclass.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2SequenceSubclass.java?rev=1039425&view=auto
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2SequenceSubclass.java (added)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/TestBean2SequenceSubclass.java Fri Nov 26 15:45:07 2010
@@ -0,0 +1,21 @@
+/*
+ * 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.pivot.json.test;
+
+public class TestBean2SequenceSubclass extends TestBean2Sequence {
+    private static final long serialVersionUID = 0;
+}