summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tickets/Ticket695.java
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket695.java')
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket695.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket695.java b/uitest/src/com/vaadin/tests/tickets/Ticket695.java
new file mode 100644
index 0000000000..e539f999b3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket695.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.tickets;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import com.vaadin.Application;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.UI.LegacyWindow;
+
+@SuppressWarnings("serial")
+public class Ticket695 extends Application.LegacyApplication {
+
+ @Override
+ public void init() {
+ final LegacyWindow w = new LegacyWindow("Serialization test #695");
+ setMainWindow(w);
+ Button b = new Button("Serialize ApplicationContext");
+ w.addComponent(b);
+ b.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ try {
+ ObjectOutputStream oos = new ObjectOutputStream(buffer);
+ long t = System.currentTimeMillis();
+ oos.writeObject(getContext());
+ w.showNotification("ApplicationContext serialized ("
+ + buffer.size() + "bytes) in "
+ + (System.currentTimeMillis() - t) + "ms");
+ } catch (IOException e) {
+ e.printStackTrace();
+ w.showNotification("ApplicationContext serialization failed - see console for stacktrace");
+ }
+
+ }
+ });
+ }
+
+}