aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/ui
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-04-05 18:41:52 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-09 06:41:32 +0000
commit8a2e8ff43e477f6269dc21469efee044d65e12b8 (patch)
tree59fee9733a60473a538925ac079b37fe07389b27 /uitest/src/com/vaadin/tests/components/ui
parentceb91c2f3c283177b36af6cb046723167493baf9 (diff)
downloadvaadin-framework-8a2e8ff43e477f6269dc21469efee044d65e12b8.tar.gz
vaadin-framework-8a2e8ff43e477f6269dc21469efee044d65e12b8.zip
Fixed broken tests
* Added missing screenshot identifiers * Removed redundant test * DebugConsole -> DebugWindow * Updated test to show why serialization fails * Fixed problems caused by added maximize button Change-Id: I5cf76fec7170747120b7243f9693851cd52c12af
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/ui')
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIInitException.html4
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UISerialization.java56
2 files changed, 34 insertions, 26 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitException.html b/uitest/src/com/vaadin/tests/components/ui/UIInitException.html
index c2b1b33059..68b11e7942 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UIInitException.html
+++ b/uitest/src/com/vaadin/tests/components/ui/UIInitException.html
@@ -17,9 +17,9 @@
<td></td>
</tr>
<tr>
- <td>assertText</td>
- <td>//html/body/div/pre</td>
+ <td>assertTextPresent</td>
<td>Catch me if you can</td>
+ <td></td>
</tr>
</tbody></table>
</body>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java
index 5f3d8d97de..90021a0bf4 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java
+++ b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java
@@ -20,15 +20,19 @@ import java.io.ByteArrayOutputStream;
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 {
@@ -42,21 +46,29 @@ 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));
}
}
@@ -64,20 +76,16 @@ public class UISerialization extends AbstractTestUI {
}
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) {