summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/tests/robustness/Robustness.java
diff options
context:
space:
mode:
authorHenri Sara <henri.sara@itmill.com>2009-05-11 09:19:03 +0000
committerHenri Sara <henri.sara@itmill.com>2009-05-11 09:19:03 +0000
commitadc8c0ad3573272c236040c3a76005b9e73a5737 (patch)
treea3860704dbd5b82dc6af38684b80f8ef79a32722 /src/com/vaadin/tests/robustness/Robustness.java
parent5abc870dda584d0c2fc47fd5eec4ae3de3fa240e (diff)
downloadvaadin-framework-adc8c0ad3573272c236040c3a76005b9e73a5737.tar.gz
vaadin-framework-adc8c0ad3573272c236040c3a76005b9e73a5737.zip
#2904: initial bulk rename "com.itmill.toolkit" -> "com.vaadin"
- com.itmill.toolkit.external not yet fully renamed svn changeset:7715/svn branch:6.0
Diffstat (limited to 'src/com/vaadin/tests/robustness/Robustness.java')
-rw-r--r--src/com/vaadin/tests/robustness/Robustness.java86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/com/vaadin/tests/robustness/Robustness.java b/src/com/vaadin/tests/robustness/Robustness.java
new file mode 100644
index 0000000000..6294e09d4e
--- /dev/null
+++ b/src/com/vaadin/tests/robustness/Robustness.java
@@ -0,0 +1,86 @@
+package com.vaadin.tests.robustness;
+
+import com.vaadin.automatedtests.util.Log;
+import com.vaadin.tests.util.RandomComponents;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Button.ClickEvent;
+
+public abstract class Robustness extends com.vaadin.Application
+ implements Button.ClickListener {
+
+ static int totalCount = 0;
+
+ int count = 0;
+
+ final Window main = new Window("Robustness tests by featurebrowser");
+
+ Button close = new Button("Close application");
+
+ Button remove = new Button("Remove all components");
+
+ Button create = new Button("Create");
+
+ Label label = new Label();
+
+ ComponentContainer stressLayout;
+
+ RandomComponents randomComponents = new RandomComponents();
+
+ @Override
+ public void init() {
+ createNewView();
+ }
+
+ public void createNewView() {
+ setMainWindow(main);
+ main.removeAllComponents();
+
+ main.addComponent(label);
+ main.addComponent(close);
+ main.addComponent(remove);
+ main.addComponent(create);
+ close.addListener(this);
+ remove.addListener(this);
+ create.addListener(this);
+
+ remove.setDescription("After this garbage collector should"
+ + " be able to collect every component"
+ + " inside stressLayout.");
+
+ close.setDebugId("close");
+ remove.setDebugId("remove");
+ create.setDebugId("create");
+
+ }
+
+ public void buttonClick(ClickEvent event) {
+ if (event.getButton() == create) {
+ create();
+ } else if (event.getButton() == remove) {
+ main.removeAllComponents();
+ close.removeListener(this);
+ remove.removeListener(this);
+ create.removeListener(this);
+ close = null;
+ remove = null;
+ create = null;
+ label = null;
+ stressLayout = null;
+ System.out.println("main.getLayout()=" + main.getLayout());
+ System.out.println(Log.getMemoryStatistics());
+ } else if (event.getButton() == close) {
+ System.out.println("Before close, memory statistics:");
+ System.out.println(Log.getMemoryStatistics());
+ close();
+ // Still valueUnbound (session expiration) needs to occur for GC to
+ // do its work
+ System.out.println("After close, memory statistics:");
+ System.out.println(Log.getMemoryStatistics());
+ }
+ }
+
+ public abstract void create();
+}