From 44758a2791a568f97a11e7da918444e4fffec84e Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Thu, 16 Aug 2012 09:47:14 +0300 Subject: Don't decode enum as an object (#9333) --- .../vaadin/tests/serialization/SerializerTest.html | 40 ++++++++++++---------- .../vaadin/tests/serialization/SerializerTest.java | 12 +++++++ .../widgetset/client/SerializerTestConnector.java | 11 ++++++ .../tests/widgetset/client/SerializerTestRpc.java | 3 ++ 4 files changed, 48 insertions(+), 18 deletions(-) (limited to 'tests/testbench/com') diff --git a/tests/testbench/com/vaadin/tests/serialization/SerializerTest.html b/tests/testbench/com/vaadin/tests/serialization/SerializerTest.html index 3d52356cab..4417fabf14 100644 --- a/tests/testbench/com/vaadin/tests/serialization/SerializerTest.html +++ b/tests/testbench/com/vaadin/tests/serialization/SerializerTest.html @@ -18,90 +18,94 @@ assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[16] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[17] 1. sendBoolean: false, false, [false, false, true, false, true, true] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[15] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[16] 2. sendByte: 5, -12, [3, 1, 2] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[14] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[15] 3. sendChar: Å, ∫, [a, b, c, d] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[13] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[14] 4. sendInt: 2, 5, [2147483647, 0] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[12] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[13] 5. sendLong: -57841235865, 577431841358, [57, 0] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[11] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[12] 6. sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[10] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[11] 7. sendDouble: 0.423310825130748, 5.859874482048838, [2.0, 1.7976931348623157E308, 4.9E-324] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[9] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[10] 8. sendString: Taegghiiiinnrsssstt‡ assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[8] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[9] 9. sendConnector: com.vaadin.tests.widgetset.server.SerializerTestExtension assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[7] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[8] 10. sendBean: ComplexTestBean [innerBean1=SimpleTestBean(1), innerBean2=SimpleTestBean(3), innerBeanCollection=[SimpleTestBean(6), SimpleTestBean(0)], privimite=6], SimpleTestBean(0), [SimpleTestBean(7)] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[6] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[7] 11. sendNull: null, Not null assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[5] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[6] 12. sendNestedArray: [[7, 5]], [[SimpleTestBean(2)], [SimpleTestBean(4)]] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[4] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[5] 13. sendList: [-234, 5, 8], class com.vaadin.tests.widgetset.server.SerializerTestExtension, class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(-568), SimpleTestBean(234)] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[3] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[4] 14. sendArrayList: [[2], [2]], [[2, 1], [2, 3]], [[SimpleTestBean(7)]] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[2] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[3] 15. sendSet: [-12, -7, -4], class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(2), SimpleTestBean(3)] assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[2] 16. sendMap: {a=null}, [com.vaadin.tests.widgetset.server.SerializerTestExtension=false], [2=com.vaadin.tests.widgetset.server.SerializerTestExtension], {SimpleTestBean(4)=SimpleTestBean(-4), SimpleTestBean(-5)=SimpleTestBean(5)} assertText - vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0] + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1] 17. sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}} - + + assertText + vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0] + 18. sendEnum: PREFORMATTED, [XHTML, RAW], [PREFORMATTED, XML] + diff --git a/tests/testbench/com/vaadin/tests/serialization/SerializerTest.java b/tests/testbench/com/vaadin/tests/serialization/SerializerTest.java index da4b5dd7d9..a301ecf828 100644 --- a/tests/testbench/com/vaadin/tests/serialization/SerializerTest.java +++ b/tests/testbench/com/vaadin/tests/serialization/SerializerTest.java @@ -28,6 +28,7 @@ import java.util.Set; import com.vaadin.annotations.Widgetset; import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.terminal.WrappedRequest; import com.vaadin.tests.components.AbstractTestRoot; import com.vaadin.tests.util.Log; @@ -122,6 +123,10 @@ public class SerializerTest extends AbstractTestRoot { } }); + rpc.sendEnum(ContentMode.TEXT, new ContentMode[] { + ContentMode.PREFORMATTED, ContentMode.XML }, + Arrays.asList(ContentMode.XHTML, ContentMode.RAW)); + testExtension.registerRpc(new SerializerTestRpc() { @Override public void sendBoolean(boolean value, Boolean boxedValue, @@ -288,6 +293,13 @@ public class SerializerTest extends AbstractTestRoot { log.log("sendWrappedGenerics: " + generics.toString()); } + @Override + public void sendEnum(ContentMode contentMode, ContentMode[] array, + List list) { + log.log("sendEnum: " + contentMode + ", " + + Arrays.toString(array) + ", " + list); + } + }); } diff --git a/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestConnector.java index 3977ff7f71..9fb6807bb7 100644 --- a/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestConnector.java +++ b/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestConnector.java @@ -28,6 +28,7 @@ import java.util.Set; import com.vaadin.shared.Connector; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.terminal.gwt.client.communication.RpcProxy; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.extensions.AbstractExtensionConnector; @@ -231,6 +232,16 @@ public class SerializerTestConnector extends AbstractExtensionConnector { objectListArray[0] }, new List[] { Collections .singletonList(beanListArray[0].get(0)) }); } + + @Override + public void sendEnum(ContentMode contentMode, ContentMode[] array, + List list) { + ContentMode nextContentMode = ContentMode.values()[contentMode + .ordinal() + 1]; + rpc.sendEnum(nextContentMode, + list.toArray(new ContentMode[list.size()]), + Arrays.asList(array)); + } }); } diff --git a/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestRpc.java b/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestRpc.java index 47a26b7408..eb3a20e90e 100644 --- a/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestRpc.java +++ b/tests/testbench/com/vaadin/tests/widgetset/client/SerializerTestRpc.java @@ -23,6 +23,7 @@ import java.util.Set; import com.vaadin.shared.Connector; import com.vaadin.shared.communication.ClientRpc; import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.label.ContentMode; @SuppressWarnings("javadoc") public interface SerializerTestRpc extends ServerRpc, ClientRpc { @@ -73,4 +74,6 @@ public interface SerializerTestRpc extends ServerRpc, ClientRpc { public void sendWrappedGenerics( Map, Map>> generics); + public void sendEnum(ContentMode contentMode, ContentMode[] array, List list); + } -- cgit v1.2.3