summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Laakso <jani.laakso@itmill.com>2008-02-07 13:56:52 +0000
committerJani Laakso <jani.laakso@itmill.com>2008-02-07 13:56:52 +0000
commit35c5bdc36e601fd3e877e7554ca2df33cf5e2c74 (patch)
treedde48f184ffd8524a0cad76ca2be753974f63fee
parente5bd74c418c06b4647ffd51d52b6bd9ef2246648 (diff)
downloadvaadin-framework-35c5bdc36e601fd3e877e7554ca2df33cf5e2c74.tar.gz
vaadin-framework-35c5bdc36e601fd3e877e7554ca2df33cf5e2c74.zip
Refactored robustness/leak tests.s.
svn changeset:3733/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/tests/robustness/Robustness.java60
-rw-r--r--src/com/itmill/toolkit/tests/robustness/RobustnessComplex.java41
-rw-r--r--src/com/itmill/toolkit/tests/robustness/RobustnessSimple.java40
3 files changed, 63 insertions, 78 deletions
diff --git a/src/com/itmill/toolkit/tests/robustness/Robustness.java b/src/com/itmill/toolkit/tests/robustness/Robustness.java
new file mode 100644
index 0000000000..41af72f3b5
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/robustness/Robustness.java
@@ -0,0 +1,60 @@
+package com.itmill.toolkit.tests.robustness;
+
+import com.itmill.toolkit.tests.util.Log;
+import com.itmill.toolkit.tests.util.RandomComponents;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.ComponentContainer;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.Window;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+
+public abstract class Robustness extends com.itmill.toolkit.Application
+ implements Button.ClickListener {
+
+ static int totalCount = 0;
+
+ int count = 0;
+
+ final Window main = new Window("Robustness tests by featurebrowser");
+
+ final Button close = new Button("Close application");
+
+ final Button create = new Button("Create");
+
+ final Label label = new Label();
+
+ ComponentContainer stressLayout;
+
+ RandomComponents randomComponents = new RandomComponents();
+
+ public void init() {
+ createNewView();
+ }
+
+ public void createNewView() {
+ setMainWindow(main);
+ main.removeAllComponents();
+
+ main.addComponent(label);
+ main.addComponent(close);
+ main.addComponent(create);
+ close.addListener(this);
+ create.addListener(this);
+
+ create.setDebugId("createButton");
+ }
+
+ public void buttonClick(ClickEvent event) {
+ if (event.getButton() == create)
+ create();
+ else if (event.getButton() == close) {
+ System.out.println("Before close, memory statistics:");
+ System.out.println(Log.getMemoryStatistics());
+ close();
+ System.out.println("After close, memory statistics:");
+ System.out.println(Log.getMemoryStatistics());
+ }
+ }
+
+ public abstract void create();
+}
diff --git a/src/com/itmill/toolkit/tests/robustness/RobustnessComplex.java b/src/com/itmill/toolkit/tests/robustness/RobustnessComplex.java
index 94cb3e0c0b..013632a6e8 100644
--- a/src/com/itmill/toolkit/tests/robustness/RobustnessComplex.java
+++ b/src/com/itmill/toolkit/tests/robustness/RobustnessComplex.java
@@ -1,51 +1,12 @@
package com.itmill.toolkit.tests.robustness;
import com.itmill.toolkit.tests.util.Log;
-import com.itmill.toolkit.tests.util.RandomComponents;
import com.itmill.toolkit.ui.Button;
-import com.itmill.toolkit.ui.ComponentContainer;
import com.itmill.toolkit.ui.Label;
-import com.itmill.toolkit.ui.Window;
-import com.itmill.toolkit.ui.Button.ClickEvent;
-public class RobustnessComplex extends com.itmill.toolkit.Application implements
+public class RobustnessComplex extends Robustness implements
Button.ClickListener {
- static int totalCount = 0;
-
- int count = 0;
-
- final Window main = new Window("Robustness tests by featurebrowser");
-
- final Button button = new Button("Create");
-
- final Label label = new Label();
-
- ComponentContainer stressLayout;
-
- RandomComponents randomComponents = new RandomComponents();
-
- public void init() {
- createNewView();
- }
-
- public void createNewView() {
- setMainWindow(main);
- main.removeAllComponents();
-
- main.addComponent(label);
- main.addComponent(button);
- button.addListener(this);
-
- button.setDebugId("createButton");
-
- create();
- }
-
- public void buttonClick(ClickEvent event) {
- create();
- }
-
/**
* Create complex layouts with components and listeners.
*/
diff --git a/src/com/itmill/toolkit/tests/robustness/RobustnessSimple.java b/src/com/itmill/toolkit/tests/robustness/RobustnessSimple.java
index c80f14516c..9052274a80 100644
--- a/src/com/itmill/toolkit/tests/robustness/RobustnessSimple.java
+++ b/src/com/itmill/toolkit/tests/robustness/RobustnessSimple.java
@@ -2,50 +2,14 @@ package com.itmill.toolkit.tests.robustness;
import com.itmill.toolkit.tests.util.Log;
import com.itmill.toolkit.ui.Button;
-import com.itmill.toolkit.ui.ComponentContainer;
import com.itmill.toolkit.ui.Label;
import com.itmill.toolkit.ui.OrderedLayout;
-import com.itmill.toolkit.ui.Window;
-import com.itmill.toolkit.ui.Button.ClickEvent;
-public class RobustnessSimple extends com.itmill.toolkit.Application implements
+public class RobustnessSimple extends Robustness implements
Button.ClickListener {
- static int totalCount = 0;
-
- int count = 0;
-
- final Window main = new Window("Robustness tests by featurebrowser");
-
- final Button button = new Button("Create");
-
- final Label label = new Label();
-
- ComponentContainer stressLayout;
-
- public void init() {
- createNewView();
- }
-
- public void createNewView() {
- setMainWindow(main);
- main.removeAllComponents();
-
- main.addComponent(label);
- main.addComponent(button);
- button.addListener(this);
-
- button.setDebugId("createButton");
-
- create();
- }
-
- public void buttonClick(ClickEvent event) {
- create();
- }
-
/**
- * Create single orderedlayout with 100 labels.
+ * Create single orderedlayout with a label containing 1Mb of data
*/
public void create() {
count++;