]> source.dussan.org Git - vaadin-framework.git/commitdiff
#1410 Tests for addListener/removeListener/getListener
authorArtur Signell <artur.signell@itmill.com>
Tue, 19 Apr 2011 13:18:29 +0000 (13:18 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 19 Apr 2011 13:18:29 +0000 (13:18 +0000)
svn changeset:18389/svn branch:6.6

31 files changed:
tests/src/com/vaadin/tests/server/AbstractBeanContainerListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/AbstractContainerListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/AbstractInMemoryContainerListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/AbstractPropertyListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/IndexedContainerListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/PropertysetItemListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/ListenerMethods.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/abstractcomponentcontainer/AbstractComponentContainerListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/button/ButtonListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/datefield/DateFieldListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/embedded/EmbeddedListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/gridlayout/GridLayoutListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/label/LabelListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/loginform/LoginFormListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/panel/PanelListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/popupview/PopupViewListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/select/SelectListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/table/TableListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/upload/UploadListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/urifragmentutility/UriFragmentUtilityListeners.java [new file with mode: 0644]
tests/src/com/vaadin/tests/server/component/window/WindowListeners.java [new file with mode: 0644]

diff --git a/tests/src/com/vaadin/tests/server/AbstractBeanContainerListeners.java b/tests/src/com/vaadin/tests/server/AbstractBeanContainerListeners.java
new file mode 100644 (file)
index 0000000..7693a0b
--- /dev/null
@@ -0,0 +1,15 @@
+package com.vaadin.tests.server;\r
+\r
+import com.vaadin.data.Container.PropertySetChangeEvent;\r
+import com.vaadin.data.Container.PropertySetChangeListener;\r
+import com.vaadin.data.util.BeanItemContainer;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+\r
+public class AbstractBeanContainerListeners extends ListenerMethods {\r
+    public void testPropertySetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(BeanItemContainer.class,\r
+                PropertySetChangeEvent.class, PropertySetChangeListener.class,\r
+                new BeanItemContainer<PropertySetChangeListener>(\r
+                        PropertySetChangeListener.class));\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/AbstractContainerListeners.java b/tests/src/com/vaadin/tests/server/AbstractContainerListeners.java
new file mode 100644 (file)
index 0000000..6c9165d
--- /dev/null
@@ -0,0 +1,21 @@
+package com.vaadin.tests.server;\r
+\r
+import com.vaadin.data.Container.ItemSetChangeEvent;\r
+import com.vaadin.data.Container.ItemSetChangeListener;\r
+import com.vaadin.data.Container.PropertySetChangeEvent;\r
+import com.vaadin.data.Container.PropertySetChangeListener;\r
+import com.vaadin.data.util.IndexedContainer;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+\r
+public class AbstractContainerListeners extends ListenerMethods {\r
+\r
+    public void testItemSetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(IndexedContainer.class,\r
+                ItemSetChangeEvent.class, ItemSetChangeListener.class);\r
+    }\r
+\r
+    public void testPropertySetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(IndexedContainer.class,\r
+                PropertySetChangeEvent.class, PropertySetChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/AbstractInMemoryContainerListeners.java b/tests/src/com/vaadin/tests/server/AbstractInMemoryContainerListeners.java
new file mode 100644 (file)
index 0000000..aae238a
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server;\r
+\r
+import com.vaadin.data.Container.ItemSetChangeEvent;\r
+import com.vaadin.data.Container.ItemSetChangeListener;\r
+import com.vaadin.data.util.IndexedContainer;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+\r
+public class AbstractInMemoryContainerListeners extends ListenerMethods {\r
+    public void testItemSetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(IndexedContainer.class,\r
+                ItemSetChangeEvent.class, ItemSetChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/AbstractPropertyListeners.java b/tests/src/com/vaadin/tests/server/AbstractPropertyListeners.java
new file mode 100644 (file)
index 0000000..015d131
--- /dev/null
@@ -0,0 +1,24 @@
+package com.vaadin.tests.server;\r
+\r
+import com.vaadin.data.Property.ReadOnlyStatusChangeEvent;\r
+import com.vaadin.data.Property.ReadOnlyStatusChangeListener;\r
+import com.vaadin.data.Property.ValueChangeEvent;\r
+import com.vaadin.data.Property.ValueChangeListener;\r
+import com.vaadin.data.util.AbstractProperty;\r
+import com.vaadin.data.util.ObjectProperty;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+\r
+public class AbstractPropertyListeners extends ListenerMethods {\r
+    public void testValueChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(AbstractProperty.class,\r
+                ValueChangeEvent.class, ValueChangeListener.class,\r
+                new ObjectProperty<String>(""));\r
+    }\r
+\r
+    public void testReadOnlyStatusChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(AbstractProperty.class,\r
+                ReadOnlyStatusChangeEvent.class,\r
+                ReadOnlyStatusChangeListener.class, new ObjectProperty<String>(\r
+                        ""));\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/IndexedContainerListeners.java b/tests/src/com/vaadin/tests/server/IndexedContainerListeners.java
new file mode 100644 (file)
index 0000000..d2e0468
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.tests.server;\r
+\r
+import com.vaadin.data.Container.PropertySetChangeEvent;\r
+import com.vaadin.data.Container.PropertySetChangeListener;\r
+import com.vaadin.data.Property.ValueChangeEvent;\r
+import com.vaadin.data.Property.ValueChangeListener;\r
+import com.vaadin.data.util.IndexedContainer;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+\r
+public class IndexedContainerListeners extends ListenerMethods {\r
+    public void testValueChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(IndexedContainer.class,\r
+                ValueChangeEvent.class, ValueChangeListener.class);\r
+    }\r
+\r
+    public void testPropertySetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(IndexedContainer.class,\r
+                PropertySetChangeEvent.class, PropertySetChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/PropertysetItemListeners.java b/tests/src/com/vaadin/tests/server/PropertysetItemListeners.java
new file mode 100644 (file)
index 0000000..0e0192b
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server;\r
+\r
+import com.vaadin.data.Item.PropertySetChangeEvent;\r
+import com.vaadin.data.Item.PropertySetChangeListener;\r
+import com.vaadin.data.util.PropertysetItem;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+\r
+public class PropertysetItemListeners extends ListenerMethods {\r
+    public void testPropertySetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(PropertysetItem.class,\r
+                PropertySetChangeEvent.class, PropertySetChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/ListenerMethods.java b/tests/src/com/vaadin/tests/server/component/ListenerMethods.java
new file mode 100644 (file)
index 0000000..ba52c4c
--- /dev/null
@@ -0,0 +1,170 @@
+package com.vaadin.tests.server.component;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.easymock.EasyMock;
+import org.junit.Assert;
+
+import com.vaadin.tests.VaadinClasses;
+import com.vaadin.ui.Component;
+
+public abstract class ListenerMethods extends TestCase {
+
+    public static void main(String[] args) {
+        findAllListenerMethods();
+    }
+
+    private static void findAllListenerMethods() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        for (Class<?> c : VaadinClasses.getAllServerSideClasses()) {
+            while (c != null && c.getName().startsWith("com.vaadin.")) {
+                classes.add(c);
+                c = c.getSuperclass();
+            }
+        }
+
+        for (Class<?> c : classes) {
+            boolean found = false;
+            for (Method m : c.getDeclaredMethods()) {
+                if (m.getName().equals("addListener")) {
+                    if (m.getParameterTypes().length != 1) {
+                        continue;
+                    }
+                    String packageName = "com.vaadin.tests.server";
+                    if (Component.class.isAssignableFrom(c)) {
+                        packageName += ".component."
+                                + c.getSimpleName().toLowerCase();
+                        continue;
+                    }
+
+                    if (!found) {
+                        found = true;
+                        System.out.println("package " + packageName + ";");
+
+                        System.out.println("import "
+                                + ListenerMethods.class.getName() + ";");
+                        System.out.println("import " + c.getName() + ";");
+                        System.out.println("public class " + c.getSimpleName()
+                                + "Listeners extends "
+                                + ListenerMethods.class.getSimpleName() + " {");
+                    }
+
+                    String listenerClassName = m.getParameterTypes()[0]
+                            .getSimpleName();
+                    String eventClassName = listenerClassName.replaceFirst(
+                            "Listener$", "Event");
+                    System.out.println("public void test" + listenerClassName
+                            + "() throws Exception {");
+                    System.out.println("    testListener(" + c.getSimpleName()
+                            + ".class, " + eventClassName + ".class, "
+                            + listenerClassName + ".class);");
+                    System.out.println("}");
+                }
+            }
+            if (found) {
+                System.out.println("}");
+                System.out.println();
+            }
+        }
+    }
+
+    protected void testListenerAddGetRemove(Class<?> testClass,
+            Class<?> eventClass, Class<?> listenerClass) throws Exception {
+        // Create a component for testing
+        Object c = testClass.newInstance();
+        testListenerAddGetRemove(testClass, eventClass, listenerClass, c);
+
+    }
+
+    protected void testListenerAddGetRemove(Class<?> cls, Class<?> eventClass,
+            Class<?> listenerClass, Object c) throws Exception {
+
+        Object mockListener1 = EasyMock.createMock(listenerClass);
+        Object mockListener2 = EasyMock.createMock(listenerClass);
+
+        // Verify we start from no listeners
+        verifyListeners(c, eventClass);
+
+        // Add one listener and verify
+        addListener(c, mockListener1, listenerClass);
+        verifyListeners(c, eventClass, mockListener1);
+
+        // Add another listener and verify
+        addListener(c, mockListener2, listenerClass);
+        verifyListeners(c, eventClass, mockListener1, mockListener2);
+
+        // Ensure we can fetch using parent class also
+        if (eventClass.getSuperclass() != null) {
+            verifyListeners(c, eventClass.getSuperclass(), mockListener1,
+                    mockListener2);
+        }
+
+        // Remove the first and verify
+        removeListener(c, mockListener1, listenerClass);
+        verifyListeners(c, eventClass, mockListener2);
+
+        // Remove the remaining and verify
+        removeListener(c, mockListener2, listenerClass);
+        verifyListeners(c, eventClass);
+
+    }
+
+    private void removeListener(Object c, Object listener,
+            Class<?> listenerClass) throws IllegalArgumentException,
+            IllegalAccessException, InvocationTargetException,
+            SecurityException, NoSuchMethodException {
+        Method method = getRemoveListenerMethod(c.getClass(), listenerClass);
+        method.invoke(c, listener);
+
+    }
+
+    private void addListener(Object c, Object listener1, Class<?> listenerClass)
+            throws IllegalArgumentException, IllegalAccessException,
+            InvocationTargetException, SecurityException, NoSuchMethodException {
+        Method method = getAddListenerMethod(c.getClass(), listenerClass);
+        method.invoke(c, listener1);
+    }
+
+    private Collection<?> getListeners(Object c, Class<?> eventType)
+            throws IllegalArgumentException, IllegalAccessException,
+            InvocationTargetException, SecurityException, NoSuchMethodException {
+        Method method = getGetListenersMethod(c.getClass());
+        return (Collection<?>) method.invoke(c, eventType);
+    }
+
+    private Method getGetListenersMethod(Class<? extends Object> cls)
+            throws SecurityException, NoSuchMethodException {
+        return cls.getMethod("getListeners", Class.class);
+    }
+
+    private Method getAddListenerMethod(Class<?> cls, Class<?> listenerClass)
+            throws SecurityException, NoSuchMethodException {
+        return cls.getMethod("addListener", listenerClass);
+
+    }
+
+    private Method getRemoveListenerMethod(Class<?> cls, Class<?> listenerClass)
+            throws SecurityException, NoSuchMethodException {
+        return cls.getMethod("removeListener", listenerClass);
+
+    }
+
+    private void verifyListeners(Object c, Class<?> eventClass,
+            Object... expectedListeners) throws IllegalArgumentException,
+            SecurityException, IllegalAccessException,
+            InvocationTargetException, NoSuchMethodException {
+        Collection<?> registeredListeners = getListeners(c, eventClass);
+        assertEquals("Number of listeners", expectedListeners.length,
+                registeredListeners.size());
+
+        Assert.assertArrayEquals(expectedListeners,
+                registeredListeners.toArray());
+
+    }
+}
diff --git a/tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutListeners.java b/tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutListeners.java
new file mode 100644 (file)
index 0000000..194df86
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.absolutelayout;\r
+\r
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;\r
+import com.vaadin.event.LayoutEvents.LayoutClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.AbsoluteLayout;\r
+\r
+public class AbsoluteLayoutListeners extends ListenerMethods {\r
+    public void testLayoutClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(AbsoluteLayout.class, LayoutClickEvent.class,\r
+                LayoutClickListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/abstractcomponentcontainer/AbstractComponentContainerListeners.java b/tests/src/com/vaadin/tests/server/component/abstractcomponentcontainer/AbstractComponentContainerListeners.java
new file mode 100644 (file)
index 0000000..92b95bb
--- /dev/null
@@ -0,0 +1,21 @@
+package com.vaadin.tests.server.component.abstractcomponentcontainer;\r
+\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.ComponentContainer.ComponentAttachEvent;\r
+import com.vaadin.ui.ComponentContainer.ComponentAttachListener;\r
+import com.vaadin.ui.ComponentContainer.ComponentDetachEvent;\r
+import com.vaadin.ui.ComponentContainer.ComponentDetachListener;\r
+import com.vaadin.ui.HorizontalLayout;\r
+import com.vaadin.ui.VerticalLayout;\r
+\r
+public class AbstractComponentContainerListeners extends ListenerMethods {\r
+    public void testComponentDetachListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(HorizontalLayout.class,\r
+                ComponentDetachEvent.class, ComponentDetachListener.class);\r
+    }\r
+\r
+    public void testComponentAttachListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(VerticalLayout.class,\r
+                ComponentAttachEvent.class, ComponentAttachListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldListeners.java b/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldListeners.java
new file mode 100644 (file)
index 0000000..8ffa57a
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.tests.server.component.abstractfield;\r
+\r
+import com.vaadin.data.Property.ReadOnlyStatusChangeEvent;\r
+import com.vaadin.data.Property.ReadOnlyStatusChangeListener;\r
+import com.vaadin.data.Property.ValueChangeEvent;\r
+import com.vaadin.data.Property.ValueChangeListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Button;\r
+\r
+public class AbstractFieldListeners extends ListenerMethods {\r
+    public void testReadOnlyStatusChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Button.class, ReadOnlyStatusChangeEvent.class,\r
+                ReadOnlyStatusChangeListener.class);\r
+    }\r
+\r
+    public void testValueChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Button.class, ValueChangeEvent.class,\r
+                ValueChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutListeners.java b/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutListeners.java
new file mode 100644 (file)
index 0000000..0d6a1e0
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.abstractorderedlayout;\r
+\r
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;\r
+import com.vaadin.event.LayoutEvents.LayoutClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.VerticalLayout;\r
+\r
+public class AbstractOrderedLayoutListeners extends ListenerMethods {\r
+    public void testLayoutClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(VerticalLayout.class, LayoutClickEvent.class,\r
+                LayoutClickListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectListeners.java b/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectListeners.java
new file mode 100644 (file)
index 0000000..a30e3c2
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.tests.server.component.abstractselect;\r
+\r
+import com.vaadin.data.Container.ItemSetChangeEvent;\r
+import com.vaadin.data.Container.ItemSetChangeListener;\r
+import com.vaadin.data.Container.PropertySetChangeEvent;\r
+import com.vaadin.data.Container.PropertySetChangeListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.ComboBox;\r
+\r
+public class AbstractSelectListeners extends ListenerMethods {\r
+    public void testItemSetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(ComboBox.class, ItemSetChangeEvent.class,\r
+                ItemSetChangeListener.class);\r
+    }\r
+\r
+    public void testPropertySetChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(ComboBox.class, PropertySetChangeEvent.class,\r
+                PropertySetChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelListeners.java b/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelListeners.java
new file mode 100644 (file)
index 0000000..9c951aa
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.abstractsplitpanel;\r
+\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.AbstractSplitPanel.SplitterClickEvent;\r
+import com.vaadin.ui.AbstractSplitPanel.SplitterClickListener;\r
+import com.vaadin.ui.HorizontalSplitPanel;\r
+\r
+public class AbstractSplitPanelListeners extends ListenerMethods {\r
+    public void testSplitterClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(HorizontalSplitPanel.class,\r
+                SplitterClickEvent.class, SplitterClickListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldListeners.java b/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldListeners.java
new file mode 100644 (file)
index 0000000..0ea7616
--- /dev/null
@@ -0,0 +1,27 @@
+package com.vaadin.tests.server.component.abstracttextfield;\r
+\r
+import com.vaadin.event.FieldEvents.BlurEvent;\r
+import com.vaadin.event.FieldEvents.BlurListener;\r
+import com.vaadin.event.FieldEvents.FocusEvent;\r
+import com.vaadin.event.FieldEvents.FocusListener;\r
+import com.vaadin.event.FieldEvents.TextChangeEvent;\r
+import com.vaadin.event.FieldEvents.TextChangeListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.TextField;\r
+\r
+public class AbstractTextFieldListeners extends ListenerMethods {\r
+    public void testTextChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(TextField.class, TextChangeEvent.class,\r
+                TextChangeListener.class);\r
+    }\r
+\r
+    public void testFocusListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(TextField.class, FocusEvent.class,\r
+                FocusListener.class);\r
+    }\r
+\r
+    public void testBlurListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(TextField.class, BlurEvent.class,\r
+                BlurListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/button/ButtonListeners.java b/tests/src/com/vaadin/tests/server/component/button/ButtonListeners.java
new file mode 100644 (file)
index 0000000..e33b69a
--- /dev/null
@@ -0,0 +1,27 @@
+package com.vaadin.tests.server.component.button;\r
+\r
+import com.vaadin.event.FieldEvents.BlurEvent;\r
+import com.vaadin.event.FieldEvents.BlurListener;\r
+import com.vaadin.event.FieldEvents.FocusEvent;\r
+import com.vaadin.event.FieldEvents.FocusListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.Button.ClickEvent;\r
+import com.vaadin.ui.Button.ClickListener;\r
+\r
+public class ButtonListeners extends ListenerMethods {\r
+    public void testFocusListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Button.class, FocusEvent.class,\r
+                FocusListener.class);\r
+    }\r
+\r
+    public void testBlurListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Button.class, BlurEvent.class,\r
+                BlurListener.class);\r
+    }\r
+\r
+    public void testClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Button.class, ClickEvent.class,\r
+                ClickListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java b/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java
new file mode 100644 (file)
index 0000000..040b993
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.csslayout;\r
+\r
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;\r
+import com.vaadin.event.LayoutEvents.LayoutClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.CssLayout;\r
+\r
+public class CssLayoutListeners extends ListenerMethods {\r
+    public void testLayoutClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(CssLayout.class, LayoutClickEvent.class,\r
+                LayoutClickListener.class);\r
+    }\r
+}
\ No newline at end of file
diff --git a/tests/src/com/vaadin/tests/server/component/datefield/DateFieldListeners.java b/tests/src/com/vaadin/tests/server/component/datefield/DateFieldListeners.java
new file mode 100644 (file)
index 0000000..2a698e7
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.tests.server.component.datefield;\r
+\r
+import com.vaadin.event.FieldEvents.BlurEvent;\r
+import com.vaadin.event.FieldEvents.BlurListener;\r
+import com.vaadin.event.FieldEvents.FocusEvent;\r
+import com.vaadin.event.FieldEvents.FocusListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.DateField;\r
+\r
+public class DateFieldListeners extends ListenerMethods {\r
+    public void testFocusListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(DateField.class, FocusEvent.class,\r
+                FocusListener.class);\r
+    }\r
+\r
+    public void testBlurListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(DateField.class, BlurEvent.class,\r
+                BlurListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/embedded/EmbeddedListeners.java b/tests/src/com/vaadin/tests/server/component/embedded/EmbeddedListeners.java
new file mode 100644 (file)
index 0000000..687dc71
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.embedded;\r
+\r
+import com.vaadin.event.MouseEvents.ClickEvent;\r
+import com.vaadin.event.MouseEvents.ClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Embedded;\r
+\r
+public class EmbeddedListeners extends ListenerMethods {\r
+    public void testClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Embedded.class, ClickEvent.class,\r
+                ClickListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/gridlayout/GridLayoutListeners.java b/tests/src/com/vaadin/tests/server/component/gridlayout/GridLayoutListeners.java
new file mode 100644 (file)
index 0000000..5f667d2
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.gridlayout;\r
+\r
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;\r
+import com.vaadin.event.LayoutEvents.LayoutClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.GridLayout;\r
+\r
+public class GridLayoutListeners extends ListenerMethods {\r
+    public void testLayoutClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(GridLayout.class, LayoutClickEvent.class,\r
+                LayoutClickListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/label/LabelListeners.java b/tests/src/com/vaadin/tests/server/component/label/LabelListeners.java
new file mode 100644 (file)
index 0000000..86628e1
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.label;\r
+\r
+import com.vaadin.data.Property.ValueChangeListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Label;\r
+import com.vaadin.ui.Label.ValueChangeEvent;\r
+\r
+public class LabelListeners extends ListenerMethods {\r
+    public void testValueChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Label.class, ValueChangeEvent.class,\r
+                ValueChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/loginform/LoginFormListeners.java b/tests/src/com/vaadin/tests/server/component/loginform/LoginFormListeners.java
new file mode 100644 (file)
index 0000000..8a76296
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.loginform;\r
+\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.LoginForm;\r
+import com.vaadin.ui.LoginForm.LoginEvent;\r
+import com.vaadin.ui.LoginForm.LoginListener;\r
+\r
+public class LoginFormListeners extends ListenerMethods {\r
+    public void testLoginListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(LoginForm.class, LoginEvent.class,\r
+                LoginListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupListeners.java b/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupListeners.java
new file mode 100644 (file)
index 0000000..1ce7cf7
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.tests.server.component.optiongroup;\r
+\r
+import com.vaadin.event.FieldEvents.BlurEvent;\r
+import com.vaadin.event.FieldEvents.BlurListener;\r
+import com.vaadin.event.FieldEvents.FocusEvent;\r
+import com.vaadin.event.FieldEvents.FocusListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.OptionGroup;\r
+\r
+public class OptionGroupListeners extends ListenerMethods {\r
+    public void testFocusListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(OptionGroup.class, FocusEvent.class,\r
+                FocusListener.class);\r
+    }\r
+\r
+    public void testBlurListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(OptionGroup.class, BlurEvent.class,\r
+                BlurListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/panel/PanelListeners.java b/tests/src/com/vaadin/tests/server/component/panel/PanelListeners.java
new file mode 100644 (file)
index 0000000..fe6f4bd
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.panel;\r
+\r
+import com.vaadin.event.MouseEvents.ClickEvent;\r
+import com.vaadin.event.MouseEvents.ClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Panel;\r
+\r
+public class PanelListeners extends ListenerMethods {\r
+    public void testClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Panel.class, ClickEvent.class,\r
+                ClickListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/popupview/PopupViewListeners.java b/tests/src/com/vaadin/tests/server/component/popupview/PopupViewListeners.java
new file mode 100644 (file)
index 0000000..3d3d554
--- /dev/null
@@ -0,0 +1,14 @@
+package com.vaadin.tests.server.component.popupview;\r
+\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Label;\r
+import com.vaadin.ui.PopupView;\r
+import com.vaadin.ui.PopupView.PopupVisibilityEvent;\r
+import com.vaadin.ui.PopupView.PopupVisibilityListener;\r
+\r
+public class PopupViewListeners extends ListenerMethods {\r
+    public void testPopupVisibilityListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(PopupView.class, PopupVisibilityEvent.class,\r
+                PopupVisibilityListener.class, new PopupView("", new Label()));\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/select/SelectListeners.java b/tests/src/com/vaadin/tests/server/component/select/SelectListeners.java
new file mode 100644 (file)
index 0000000..63d857e
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.tests.server.component.select;\r
+\r
+import com.vaadin.event.FieldEvents.BlurEvent;\r
+import com.vaadin.event.FieldEvents.BlurListener;\r
+import com.vaadin.event.FieldEvents.FocusEvent;\r
+import com.vaadin.event.FieldEvents.FocusListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Select;\r
+\r
+public class SelectListeners extends ListenerMethods {\r
+    public void testFocusListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Select.class, FocusEvent.class,\r
+                FocusListener.class);\r
+    }\r
+\r
+    public void testBlurListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Select.class, BlurEvent.class,\r
+                BlurListener.class);\r
+    }\r
+}
\ No newline at end of file
diff --git a/tests/src/com/vaadin/tests/server/component/table/TableListeners.java b/tests/src/com/vaadin/tests/server/component/table/TableListeners.java
new file mode 100644 (file)
index 0000000..46291c5
--- /dev/null
@@ -0,0 +1,40 @@
+package com.vaadin.tests.server.component.table;\r
+\r
+import com.vaadin.event.ItemClickEvent;\r
+import com.vaadin.event.ItemClickEvent.ItemClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Table;\r
+import com.vaadin.ui.Table.ColumnReorderEvent;\r
+import com.vaadin.ui.Table.ColumnReorderListener;\r
+import com.vaadin.ui.Table.ColumnResizeEvent;\r
+import com.vaadin.ui.Table.ColumnResizeListener;\r
+import com.vaadin.ui.Table.FooterClickEvent;\r
+import com.vaadin.ui.Table.FooterClickListener;\r
+import com.vaadin.ui.Table.HeaderClickEvent;\r
+import com.vaadin.ui.Table.HeaderClickListener;\r
+\r
+public class TableListeners extends ListenerMethods {\r
+    public void testColumnResizeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Table.class, ColumnResizeEvent.class,\r
+                ColumnResizeListener.class);\r
+    }\r
+\r
+    public void testItemClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Table.class, ItemClickEvent.class, ItemClickListener.class);\r
+    }\r
+\r
+    public void testFooterClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Table.class, FooterClickEvent.class,\r
+                FooterClickListener.class);\r
+    }\r
+\r
+    public void testHeaderClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Table.class, HeaderClickEvent.class,\r
+                HeaderClickListener.class);\r
+    }\r
+\r
+    public void testColumnReorderListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Table.class, ColumnReorderEvent.class,\r
+                ColumnReorderListener.class);\r
+    }\r
+}
\ No newline at end of file
diff --git a/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetListeners.java b/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetListeners.java
new file mode 100644 (file)
index 0000000..36cbf2d
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.tabsheet;\r
+\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.TabSheet;\r
+import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;\r
+import com.vaadin.ui.TabSheet.SelectedTabChangeListener;\r
+\r
+public class TabSheetListeners extends ListenerMethods {\r
+    public void testSelectedTabChangeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(TabSheet.class, SelectedTabChangeEvent.class,\r
+                SelectedTabChangeListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java b/tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java
new file mode 100644 (file)
index 0000000..43651b7
--- /dev/null
@@ -0,0 +1,27 @@
+package com.vaadin.tests.server.component.tree;\r
+\r
+import com.vaadin.event.ItemClickEvent;\r
+import com.vaadin.event.ItemClickEvent.ItemClickListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Tree;\r
+import com.vaadin.ui.Tree.CollapseEvent;\r
+import com.vaadin.ui.Tree.CollapseListener;\r
+import com.vaadin.ui.Tree.ExpandEvent;\r
+import com.vaadin.ui.Tree.ExpandListener;\r
+\r
+public class TreeListeners extends ListenerMethods {\r
+    public void testExpandListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Tree.class, ExpandEvent.class,\r
+                ExpandListener.class);\r
+    }\r
+\r
+    public void testItemClickListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Tree.class, ItemClickEvent.class,\r
+                ItemClickListener.class);\r
+    }\r
+\r
+    public void testCollapseListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Tree.class, CollapseEvent.class,\r
+                CollapseListener.class);\r
+    }\r
+}
\ No newline at end of file
diff --git a/tests/src/com/vaadin/tests/server/component/upload/UploadListeners.java b/tests/src/com/vaadin/tests/server/component/upload/UploadListeners.java
new file mode 100644 (file)
index 0000000..07dc64e
--- /dev/null
@@ -0,0 +1,41 @@
+package com.vaadin.tests.server.component.upload;\r
+\r
+import com.vaadin.terminal.StreamVariable.StreamingProgressEvent;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Upload;\r
+import com.vaadin.ui.Upload.FailedEvent;\r
+import com.vaadin.ui.Upload.FailedListener;\r
+import com.vaadin.ui.Upload.FinishedEvent;\r
+import com.vaadin.ui.Upload.FinishedListener;\r
+import com.vaadin.ui.Upload.ProgressListener;\r
+import com.vaadin.ui.Upload.StartedEvent;\r
+import com.vaadin.ui.Upload.StartedListener;\r
+import com.vaadin.ui.Upload.SucceededEvent;\r
+import com.vaadin.ui.Upload.SucceededListener;\r
+\r
+public class UploadListeners extends ListenerMethods {\r
+    public void testProgressListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Upload.class, StreamingProgressEvent.class,\r
+                ProgressListener.class);\r
+    }\r
+\r
+    public void testSucceededListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Upload.class, SucceededEvent.class,\r
+                SucceededListener.class);\r
+    }\r
+\r
+    public void testStartedListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Upload.class, StartedEvent.class,\r
+                StartedListener.class);\r
+    }\r
+\r
+    public void testFailedListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Upload.class, FailedEvent.class,\r
+                FailedListener.class);\r
+    }\r
+\r
+    public void testFinishedListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Upload.class, FinishedEvent.class,\r
+                FinishedListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/urifragmentutility/UriFragmentUtilityListeners.java b/tests/src/com/vaadin/tests/server/component/urifragmentutility/UriFragmentUtilityListeners.java
new file mode 100644 (file)
index 0000000..fa5c087
--- /dev/null
@@ -0,0 +1,13 @@
+package com.vaadin.tests.server.component.urifragmentutility;\r
+\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.UriFragmentUtility;\r
+import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent;\r
+import com.vaadin.ui.UriFragmentUtility.FragmentChangedListener;\r
+\r
+public class UriFragmentUtilityListeners extends ListenerMethods {\r
+    public void testFragmentChangedListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(UriFragmentUtility.class,\r
+                FragmentChangedEvent.class, FragmentChangedListener.class);\r
+    }\r
+}\r
diff --git a/tests/src/com/vaadin/tests/server/component/window/WindowListeners.java b/tests/src/com/vaadin/tests/server/component/window/WindowListeners.java
new file mode 100644 (file)
index 0000000..349d53c
--- /dev/null
@@ -0,0 +1,34 @@
+package com.vaadin.tests.server.component.window;\r
+\r
+import com.vaadin.event.FieldEvents.BlurEvent;\r
+import com.vaadin.event.FieldEvents.BlurListener;\r
+import com.vaadin.event.FieldEvents.FocusEvent;\r
+import com.vaadin.event.FieldEvents.FocusListener;\r
+import com.vaadin.tests.server.component.ListenerMethods;\r
+import com.vaadin.ui.Window;\r
+import com.vaadin.ui.Window.CloseEvent;\r
+import com.vaadin.ui.Window.CloseListener;\r
+import com.vaadin.ui.Window.ResizeEvent;\r
+import com.vaadin.ui.Window.ResizeListener;\r
+\r
+public class WindowListeners extends ListenerMethods {\r
+    public void testFocusListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Window.class, FocusEvent.class,\r
+                FocusListener.class);\r
+    }\r
+\r
+    public void testBlurListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Window.class, BlurEvent.class,\r
+                BlurListener.class);\r
+    }\r
+\r
+    public void testResizeListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Window.class, ResizeEvent.class,\r
+                ResizeListener.class);\r
+    }\r
+\r
+    public void testCloseListenerAddGetRemove() throws Exception {\r
+        testListenerAddGetRemove(Window.class, CloseEvent.class,\r
+                CloseListener.class);\r
+    }\r
+}\r