+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>sizeTestSizeFull</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTestSizeFull</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
- <td>Jan 2000</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
- <td>mouseClick</td>
- <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
- <td>9,56</td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.PrintWriter;
import java.io.Serializable;
+import java.io.StringWriter;
import java.util.Date;
import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Label;
public class UISerialization extends AbstractTestUI {
@Override
public void buttonClick(ClickEvent event) {
Date d = new Date();
- byte[] result = serialize(UISerialization.this);
- long elapsed = new Date().getTime() - d.getTime();
- log.log("Serialized UI in " + elapsed + "ms into "
- + result.length + " bytes");
- Object diffStateBefore = getConnectorTracker().getDiffState(
- UISerialization.this);
- UISerialization app = (UISerialization) deserialize(result);
- log.log("Deserialized UI in " + elapsed + "ms");
- Object diffStateAfter = getConnectorTracker().getDiffState(
- UISerialization.this);
- if (diffStateBefore.equals(diffStateAfter)) {
- log.log("Diff states match, size: "
- + diffStateBefore.toString().length());
- } else {
- log.log("Diff states do not match");
+ try {
+ byte[] result = serialize(UISerialization.this);
+ long elapsed = new Date().getTime() - d.getTime();
+ log.log("Serialized UI in " + elapsed + "ms into "
+ + result.length + " bytes");
+ Object diffStateBefore = getConnectorTracker()
+ .getDiffState(UISerialization.this);
+ UISerialization app = (UISerialization) deserialize(result);
+ log.log("Deserialized UI in " + elapsed + "ms");
+ Object diffStateAfter = getConnectorTracker().getDiffState(
+ UISerialization.this);
+ if (diffStateBefore.equals(diffStateAfter)) {
+ log.log("Diff states match, size: "
+ + diffStateBefore.toString().length());
+ } else {
+ log.log("Diff states do not match");
+ }
+ } catch (Exception e) {
+ log.log("Exception caught: " + e.getMessage());
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ addComponent(new Label(sw.toString(),
+ ContentMode.PREFORMATTED));
}
}
}
protected void serializeInstance(Class<?> cls)
- throws InstantiationException, IllegalAccessException {
+ throws InstantiationException, IllegalAccessException, IOException {
serialize((Serializable) cls.newInstance());
}
- protected byte[] serialize(Serializable serializable) {
+ protected byte[] serialize(Serializable serializable) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ObjectOutputStream oos;
- try {
- oos = new ObjectOutputStream(os);
- oos.writeObject(serializable);
- return os.toByteArray();
- } catch (IOException e) {
- throw new RuntimeException("Serialization failed", e);
- }
+ oos = new ObjectOutputStream(os);
+ oos.writeObject(serializable);
+ return os.toByteArray();
}
protected Object deserialize(byte[] result) {
</tr>
<tr>
<td>assertElementPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<td>assertElementNotPresent</td>
- <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+ <td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
<td></td>
</tr>
</tbody></table>