summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/serialization
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-12-18 15:07:21 +0200
committerVaadin Code Review <review@vaadin.com>2012-12-18 13:35:12 +0000
commita6ffd484283353825470988bf2d13093685d2761 (patch)
tree4beab888aac6ecf37a318d2eb68f1dd433acbf1e /uitest/src/com/vaadin/tests/serialization
parentca967cbe1d927d7acf5cb72683265557e0b46360 (diff)
downloadvaadin-framework-a6ffd484283353825470988bf2d13093685d2761.tar.gz
vaadin-framework-a6ffd484283353825470988bf2d13093685d2761.zip
Encode all values based on declared type (#10549)
* ServerRpc encoding uses type data from the interface * Beans encoded on the server use reflection based on declared type * Remove row numbers to enable adding test without changing old indices * Update test to send non-primitive map values Change-Id: I0462b547cb7de252564b3569420b0b24cee4515f
Diffstat (limited to 'uitest/src/com/vaadin/tests/serialization')
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTest.html41
-rw-r--r--uitest/src/com/vaadin/tests/serialization/SerializerTest.java26
2 files changed, 44 insertions, 23 deletions
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTest.html b/uitest/src/com/vaadin/tests/serialization/SerializerTest.html
index 46b1a9ed8b..63219de5c2 100644
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTest.html
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTest.html
@@ -18,93 +18,98 @@
</tr>
<tr>
<td>assertText</td>
+ <td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[18]</td>
+ <td>sendBeanSubclass: 43</td>
+</tr>
+<tr>
+ <td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[17]</td>
- <td>1. sendBoolean: false, false, [false, false, true, false, true, true]</td>
+ <td>sendBoolean: false, false, [false, false, true, false, true, true]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[16]</td>
- <td>2. sendByte: 5, -12, [3, 1, 2]</td>
+ <td>sendByte: 5, -12, [3, 1, 2]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[15]</td>
- <td>3. sendChar: Å, ∫, [a, b, c, d]</td>
+ <td>sendChar: Å, ∫, [a, b, c, d]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[14]</td>
- <td>4. sendInt: 2, 5, [2147483647, 0]</td>
+ <td>sendInt: 2, 5, [2147483647, 0]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[13]</td>
- <td>5. sendLong: -57841235865, 577431841358, [57, 0]</td>
+ <td>sendLong: -57841235865, 577431841358, [57, 0]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[12]</td>
- <td>6. sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]</td>
+ <td>sendFloat: 1.0000001, 3.14159, [-12.0, 0.0, 57.0]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[11]</td>
- <td>7. sendDouble: 0.423310825130748, 5.859874482048838, [2.0, 1.7976931348623157E308, 4.9E-324]</td>
+ <td>sendDouble: 0.423310825130748, 5.859874482048838, [2.0, 1.7976931348623157E308, 4.9E-324]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[10]</td>
- <td>8. sendString: Taegghiiiinnrsssstt‡</td>
+ <td>sendString: Taegghiiiinnrsssstt‡</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[9]</td>
- <td>9. sendConnector: com.vaadin.tests.widgetset.server.SerializerTestExtension</td>
+ <td>sendConnector: com.vaadin.tests.widgetset.server.SerializerTestExtension</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[8]</td>
- <td>10. sendBean: ComplexTestBean [innerBean1=SimpleTestBean(1), innerBean2=SimpleTestBean(3), innerBeanCollection=[SimpleTestBean(6), SimpleTestBean(0)], privimite=6], SimpleTestBean(0), [SimpleTestBean(7)]</td>
+ <td>sendBean: ComplexTestBean [innerBean1=SimpleTestBean(1), innerBean2=SimpleTestBean(3), innerBeanCollection=[SimpleTestBean(6), SimpleTestBean(0)], privimite=6], SimpleTestBean(0), [SimpleTestBean(7)]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[7]</td>
- <td>11. sendNull: null, Not null</td>
+ <td>sendNull: null, Not null</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[6]</td>
- <td>12. sendNestedArray: [[7, 5]], [[SimpleTestBean(2)], [SimpleTestBean(4)]]</td>
+ <td>sendNestedArray: [[7, 5]], [[SimpleTestBean(2)], [SimpleTestBean(4)]]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[5]</td>
- <td>13. sendList: [-234, 5, 8], class com.vaadin.tests.widgetset.server.SerializerTestExtension, class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(-568), SimpleTestBean(234)]</td>
+ <td>sendList: [-234, 5, 8], class com.vaadin.tests.widgetset.server.SerializerTestExtension, class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(-568), SimpleTestBean(234)]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[4]</td>
- <td>14. sendArrayList: [[2], [2]], [[2, 1], [2, 3]], [[SimpleTestBean(7)]]</td>
+ <td>sendArrayList: [[2], [2]], [[2, 1], [2, 3]], [[SimpleTestBean(7)]]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[3]</td>
- <td>15. sendSet: [-12, -7, -4], class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(2), SimpleTestBean(3)]</td>
+ <td>sendSet: [-12, -7, -4], class com.vaadin.tests.serialization.SerializerTest, [SimpleTestBean(2), SimpleTestBean(3)]</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[2]</td>
- <td>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)}</td>
+ <td>sendMap: {a=SimpleTestBean(1)}, [com.vaadin.tests.widgetset.server.SerializerTestExtension=SimpleTestBean(4)], [2=com.vaadin.tests.widgetset.server.SerializerTestExtension], {SimpleTestBean(4)=SimpleTestBean(-4), SimpleTestBean(-5)=SimpleTestBean(5)}</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1]</td>
- <td>17. sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}}</td>
+ <td>sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}}</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestsserializationSerializerTest::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
- <td>18. sendEnum: PREFORMATTED, [HTML, RAW], [PREFORMATTED, XML]</td>
+ <td>sendEnum: PREFORMATTED, [HTML, RAW], [PREFORMATTED, XML]</td>
</tr>
</tbody></table>
</body>
diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
index e7acd3e79b..efadf8c237 100644
--- a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
+++ b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java
@@ -46,10 +46,20 @@ public class SerializerTest extends AbstractTestUI {
protected void setup(VaadinRequest request) {
final SerializerTestExtension testExtension = new SerializerTestExtension();
addExtension(testExtension);
+
+ // Don't show row numbers to make it easier to add tests without
+ // changing all numbers
+ log.setNumberLogRows(false);
addComponent(log);
SerializerTestRpc rpc = testExtension
.getRpcProxy(SerializerTestRpc.class);
+ rpc.sendBeanSubclass(new SimpleTestBean() {
+ @Override
+ public int getValue() {
+ return 42;
+ }
+ });
rpc.sendBoolean(true, Boolean.FALSE, new boolean[] { true, true, false,
true, false, false });
rpc.sendByte((byte) 5, Byte.valueOf((byte) -12), new byte[] { 3, 1, 2 });
@@ -95,10 +105,10 @@ public class SerializerTest extends AbstractTestUI {
put("1", new SimpleTestBean(1));
put("2", new SimpleTestBean(2));
}
- }, new HashMap<Connector, Boolean>() {
+ }, new HashMap<Connector, SimpleTestBean>() {
{
- put(testExtension, true);
- put(getUI(), false);
+ put(testExtension, new SimpleTestBean(3));
+ put(getUI(), new SimpleTestBean(4));
}
}, new HashMap<Integer, Connector>() {
{
@@ -252,11 +262,12 @@ public class SerializerTest extends AbstractTestUI {
@Override
public void sendMap(Map<String, SimpleTestBean> stringMap,
- Map<Connector, Boolean> connectorMap,
+ Map<Connector, SimpleTestBean> connectorMap,
Map<Integer, Connector> intMap,
Map<SimpleTestBean, SimpleTestBean> beanMap) {
StringBuilder sb = new StringBuilder();
- for (Entry<Connector, Boolean> entry : connectorMap.entrySet()) {
+ for (Entry<Connector, SimpleTestBean> entry : connectorMap
+ .entrySet()) {
if (sb.length() == 0) {
sb.append('[');
} else {
@@ -300,6 +311,11 @@ public class SerializerTest extends AbstractTestUI {
+ Arrays.toString(array) + ", " + list);
}
+ @Override
+ public void sendBeanSubclass(SimpleTestBean bean) {
+ log.log("sendBeanSubclass: " + bean.getValue());
+ }
+
});
}