From: Artur Signell Date: Tue, 19 Apr 2011 13:18:29 +0000 (+0000) Subject: #1410 Tests for addListener/removeListener/getListener X-Git-Tag: 6.7.0.beta1~314 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8c57382cbf0b4ff6fb45b3a28a021edb288ed936;p=vaadin-framework.git #1410 Tests for addListener/removeListener/getListener svn changeset:18389/svn branch:6.6 --- diff --git a/tests/src/com/vaadin/tests/server/AbstractBeanContainerListeners.java b/tests/src/com/vaadin/tests/server/AbstractBeanContainerListeners.java new file mode 100644 index 0000000000..7693a0b2ee --- /dev/null +++ b/tests/src/com/vaadin/tests/server/AbstractBeanContainerListeners.java @@ -0,0 +1,15 @@ +package com.vaadin.tests.server; + +import com.vaadin.data.Container.PropertySetChangeEvent; +import com.vaadin.data.Container.PropertySetChangeListener; +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.tests.server.component.ListenerMethods; + +public class AbstractBeanContainerListeners extends ListenerMethods { + public void testPropertySetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(BeanItemContainer.class, + PropertySetChangeEvent.class, PropertySetChangeListener.class, + new BeanItemContainer( + PropertySetChangeListener.class)); + } +} diff --git a/tests/src/com/vaadin/tests/server/AbstractContainerListeners.java b/tests/src/com/vaadin/tests/server/AbstractContainerListeners.java new file mode 100644 index 0000000000..6c9165dffc --- /dev/null +++ b/tests/src/com/vaadin/tests/server/AbstractContainerListeners.java @@ -0,0 +1,21 @@ +package com.vaadin.tests.server; + +import com.vaadin.data.Container.ItemSetChangeEvent; +import com.vaadin.data.Container.ItemSetChangeListener; +import com.vaadin.data.Container.PropertySetChangeEvent; +import com.vaadin.data.Container.PropertySetChangeListener; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.tests.server.component.ListenerMethods; + +public class AbstractContainerListeners extends ListenerMethods { + + public void testItemSetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(IndexedContainer.class, + ItemSetChangeEvent.class, ItemSetChangeListener.class); + } + + public void testPropertySetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(IndexedContainer.class, + PropertySetChangeEvent.class, PropertySetChangeListener.class); + } +} diff --git a/tests/src/com/vaadin/tests/server/AbstractInMemoryContainerListeners.java b/tests/src/com/vaadin/tests/server/AbstractInMemoryContainerListeners.java new file mode 100644 index 0000000000..aae238ac10 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/AbstractInMemoryContainerListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server; + +import com.vaadin.data.Container.ItemSetChangeEvent; +import com.vaadin.data.Container.ItemSetChangeListener; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.tests.server.component.ListenerMethods; + +public class AbstractInMemoryContainerListeners extends ListenerMethods { + public void testItemSetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(IndexedContainer.class, + ItemSetChangeEvent.class, ItemSetChangeListener.class); + } +} diff --git a/tests/src/com/vaadin/tests/server/AbstractPropertyListeners.java b/tests/src/com/vaadin/tests/server/AbstractPropertyListeners.java new file mode 100644 index 0000000000..015d1318f7 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/AbstractPropertyListeners.java @@ -0,0 +1,24 @@ +package com.vaadin.tests.server; + +import com.vaadin.data.Property.ReadOnlyStatusChangeEvent; +import com.vaadin.data.Property.ReadOnlyStatusChangeListener; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.util.AbstractProperty; +import com.vaadin.data.util.ObjectProperty; +import com.vaadin.tests.server.component.ListenerMethods; + +public class AbstractPropertyListeners extends ListenerMethods { + public void testValueChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(AbstractProperty.class, + ValueChangeEvent.class, ValueChangeListener.class, + new ObjectProperty("")); + } + + public void testReadOnlyStatusChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(AbstractProperty.class, + ReadOnlyStatusChangeEvent.class, + ReadOnlyStatusChangeListener.class, new ObjectProperty( + "")); + } +} diff --git a/tests/src/com/vaadin/tests/server/IndexedContainerListeners.java b/tests/src/com/vaadin/tests/server/IndexedContainerListeners.java new file mode 100644 index 0000000000..d2e0468956 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/IndexedContainerListeners.java @@ -0,0 +1,20 @@ +package com.vaadin.tests.server; + +import com.vaadin.data.Container.PropertySetChangeEvent; +import com.vaadin.data.Container.PropertySetChangeListener; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.tests.server.component.ListenerMethods; + +public class IndexedContainerListeners extends ListenerMethods { + public void testValueChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(IndexedContainer.class, + ValueChangeEvent.class, ValueChangeListener.class); + } + + public void testPropertySetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(IndexedContainer.class, + PropertySetChangeEvent.class, PropertySetChangeListener.class); + } +} diff --git a/tests/src/com/vaadin/tests/server/PropertysetItemListeners.java b/tests/src/com/vaadin/tests/server/PropertysetItemListeners.java new file mode 100644 index 0000000000..0e0192bf11 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/PropertysetItemListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server; + +import com.vaadin.data.Item.PropertySetChangeEvent; +import com.vaadin.data.Item.PropertySetChangeListener; +import com.vaadin.data.util.PropertysetItem; +import com.vaadin.tests.server.component.ListenerMethods; + +public class PropertysetItemListeners extends ListenerMethods { + public void testPropertySetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(PropertysetItem.class, + PropertySetChangeEvent.class, PropertySetChangeListener.class); + } +} 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 index 0000000000..ba52c4cefe --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/ListenerMethods.java @@ -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> classes = new HashSet>(); + 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 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 index 0000000000..194df865b4 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/absolutelayout/AbsoluteLayoutListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.absolutelayout; + +import com.vaadin.event.LayoutEvents.LayoutClickEvent; +import com.vaadin.event.LayoutEvents.LayoutClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.AbsoluteLayout; + +public class AbsoluteLayoutListeners extends ListenerMethods { + public void testLayoutClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(AbsoluteLayout.class, LayoutClickEvent.class, + LayoutClickListener.class); + } +} 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 index 0000000000..92b95bb33e --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/abstractcomponentcontainer/AbstractComponentContainerListeners.java @@ -0,0 +1,21 @@ +package com.vaadin.tests.server.component.abstractcomponentcontainer; + +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.ComponentContainer.ComponentAttachEvent; +import com.vaadin.ui.ComponentContainer.ComponentAttachListener; +import com.vaadin.ui.ComponentContainer.ComponentDetachEvent; +import com.vaadin.ui.ComponentContainer.ComponentDetachListener; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.VerticalLayout; + +public class AbstractComponentContainerListeners extends ListenerMethods { + public void testComponentDetachListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(HorizontalLayout.class, + ComponentDetachEvent.class, ComponentDetachListener.class); + } + + public void testComponentAttachListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(VerticalLayout.class, + ComponentAttachEvent.class, ComponentAttachListener.class); + } +} 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 index 0000000000..8ffa57a87d --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldListeners.java @@ -0,0 +1,20 @@ +package com.vaadin.tests.server.component.abstractfield; + +import com.vaadin.data.Property.ReadOnlyStatusChangeEvent; +import com.vaadin.data.Property.ReadOnlyStatusChangeListener; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Button; + +public class AbstractFieldListeners extends ListenerMethods { + public void testReadOnlyStatusChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Button.class, ReadOnlyStatusChangeEvent.class, + ReadOnlyStatusChangeListener.class); + } + + public void testValueChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Button.class, ValueChangeEvent.class, + ValueChangeListener.class); + } +} 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 index 0000000000..0d6a1e00f8 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.abstractorderedlayout; + +import com.vaadin.event.LayoutEvents.LayoutClickEvent; +import com.vaadin.event.LayoutEvents.LayoutClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.VerticalLayout; + +public class AbstractOrderedLayoutListeners extends ListenerMethods { + public void testLayoutClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(VerticalLayout.class, LayoutClickEvent.class, + LayoutClickListener.class); + } +} 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 index 0000000000..a30e3c271a --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectListeners.java @@ -0,0 +1,20 @@ +package com.vaadin.tests.server.component.abstractselect; + +import com.vaadin.data.Container.ItemSetChangeEvent; +import com.vaadin.data.Container.ItemSetChangeListener; +import com.vaadin.data.Container.PropertySetChangeEvent; +import com.vaadin.data.Container.PropertySetChangeListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.ComboBox; + +public class AbstractSelectListeners extends ListenerMethods { + public void testItemSetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(ComboBox.class, ItemSetChangeEvent.class, + ItemSetChangeListener.class); + } + + public void testPropertySetChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(ComboBox.class, PropertySetChangeEvent.class, + PropertySetChangeListener.class); + } +} 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 index 0000000000..9c951aaf74 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.abstractsplitpanel; + +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.AbstractSplitPanel.SplitterClickEvent; +import com.vaadin.ui.AbstractSplitPanel.SplitterClickListener; +import com.vaadin.ui.HorizontalSplitPanel; + +public class AbstractSplitPanelListeners extends ListenerMethods { + public void testSplitterClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(HorizontalSplitPanel.class, + SplitterClickEvent.class, SplitterClickListener.class); + } +} 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 index 0000000000..0ea7616163 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldListeners.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.server.component.abstracttextfield; + +import com.vaadin.event.FieldEvents.BlurEvent; +import com.vaadin.event.FieldEvents.BlurListener; +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.event.FieldEvents.TextChangeEvent; +import com.vaadin.event.FieldEvents.TextChangeListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.TextField; + +public class AbstractTextFieldListeners extends ListenerMethods { + public void testTextChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(TextField.class, TextChangeEvent.class, + TextChangeListener.class); + } + + public void testFocusListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(TextField.class, FocusEvent.class, + FocusListener.class); + } + + public void testBlurListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(TextField.class, BlurEvent.class, + BlurListener.class); + } +} 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 index 0000000000..e33b69adc5 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/button/ButtonListeners.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.server.component.button; + +import com.vaadin.event.FieldEvents.BlurEvent; +import com.vaadin.event.FieldEvents.BlurListener; +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; + +public class ButtonListeners extends ListenerMethods { + public void testFocusListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Button.class, FocusEvent.class, + FocusListener.class); + } + + public void testBlurListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Button.class, BlurEvent.class, + BlurListener.class); + } + + public void testClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Button.class, ClickEvent.class, + ClickListener.class); + } +} 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 index 0000000000..040b9938dc --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.csslayout; + +import com.vaadin.event.LayoutEvents.LayoutClickEvent; +import com.vaadin.event.LayoutEvents.LayoutClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.CssLayout; + +public class CssLayoutListeners extends ListenerMethods { + public void testLayoutClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(CssLayout.class, LayoutClickEvent.class, + LayoutClickListener.class); + } +} \ 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 index 0000000000..2a698e7d09 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/datefield/DateFieldListeners.java @@ -0,0 +1,20 @@ +package com.vaadin.tests.server.component.datefield; + +import com.vaadin.event.FieldEvents.BlurEvent; +import com.vaadin.event.FieldEvents.BlurListener; +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.DateField; + +public class DateFieldListeners extends ListenerMethods { + public void testFocusListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(DateField.class, FocusEvent.class, + FocusListener.class); + } + + public void testBlurListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(DateField.class, BlurEvent.class, + BlurListener.class); + } +} 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 index 0000000000..687dc71849 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/embedded/EmbeddedListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.embedded; + +import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.event.MouseEvents.ClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Embedded; + +public class EmbeddedListeners extends ListenerMethods { + public void testClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Embedded.class, ClickEvent.class, + ClickListener.class); + } +} 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 index 0000000000..5f667d225e --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/gridlayout/GridLayoutListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.gridlayout; + +import com.vaadin.event.LayoutEvents.LayoutClickEvent; +import com.vaadin.event.LayoutEvents.LayoutClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.GridLayout; + +public class GridLayoutListeners extends ListenerMethods { + public void testLayoutClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(GridLayout.class, LayoutClickEvent.class, + LayoutClickListener.class); + } +} 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 index 0000000000..86628e1de8 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/label/LabelListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.label; + +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Label; +import com.vaadin.ui.Label.ValueChangeEvent; + +public class LabelListeners extends ListenerMethods { + public void testValueChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Label.class, ValueChangeEvent.class, + ValueChangeListener.class); + } +} 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 index 0000000000..8a7629664c --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/loginform/LoginFormListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.loginform; + +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.LoginForm; +import com.vaadin.ui.LoginForm.LoginEvent; +import com.vaadin.ui.LoginForm.LoginListener; + +public class LoginFormListeners extends ListenerMethods { + public void testLoginListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(LoginForm.class, LoginEvent.class, + LoginListener.class); + } +} 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 index 0000000000..1ce7cf76c6 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupListeners.java @@ -0,0 +1,20 @@ +package com.vaadin.tests.server.component.optiongroup; + +import com.vaadin.event.FieldEvents.BlurEvent; +import com.vaadin.event.FieldEvents.BlurListener; +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.OptionGroup; + +public class OptionGroupListeners extends ListenerMethods { + public void testFocusListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(OptionGroup.class, FocusEvent.class, + FocusListener.class); + } + + public void testBlurListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(OptionGroup.class, BlurEvent.class, + BlurListener.class); + } +} 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 index 0000000000..fe6f4bd302 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/panel/PanelListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.panel; + +import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.event.MouseEvents.ClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Panel; + +public class PanelListeners extends ListenerMethods { + public void testClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Panel.class, ClickEvent.class, + ClickListener.class); + } +} 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 index 0000000000..3d3d5546da --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/popupview/PopupViewListeners.java @@ -0,0 +1,14 @@ +package com.vaadin.tests.server.component.popupview; + +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Label; +import com.vaadin.ui.PopupView; +import com.vaadin.ui.PopupView.PopupVisibilityEvent; +import com.vaadin.ui.PopupView.PopupVisibilityListener; + +public class PopupViewListeners extends ListenerMethods { + public void testPopupVisibilityListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(PopupView.class, PopupVisibilityEvent.class, + PopupVisibilityListener.class, new PopupView("", new Label())); + } +} 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 index 0000000000..63d857e3b6 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/select/SelectListeners.java @@ -0,0 +1,20 @@ +package com.vaadin.tests.server.component.select; + +import com.vaadin.event.FieldEvents.BlurEvent; +import com.vaadin.event.FieldEvents.BlurListener; +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Select; + +public class SelectListeners extends ListenerMethods { + public void testFocusListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Select.class, FocusEvent.class, + FocusListener.class); + } + + public void testBlurListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Select.class, BlurEvent.class, + BlurListener.class); + } +} \ 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 index 0000000000..46291c5b9a --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/table/TableListeners.java @@ -0,0 +1,40 @@ +package com.vaadin.tests.server.component.table; + +import com.vaadin.event.ItemClickEvent; +import com.vaadin.event.ItemClickEvent.ItemClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.ColumnReorderEvent; +import com.vaadin.ui.Table.ColumnReorderListener; +import com.vaadin.ui.Table.ColumnResizeEvent; +import com.vaadin.ui.Table.ColumnResizeListener; +import com.vaadin.ui.Table.FooterClickEvent; +import com.vaadin.ui.Table.FooterClickListener; +import com.vaadin.ui.Table.HeaderClickEvent; +import com.vaadin.ui.Table.HeaderClickListener; + +public class TableListeners extends ListenerMethods { + public void testColumnResizeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Table.class, ColumnResizeEvent.class, + ColumnResizeListener.class); + } + + public void testItemClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Table.class, ItemClickEvent.class, ItemClickListener.class); + } + + public void testFooterClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Table.class, FooterClickEvent.class, + FooterClickListener.class); + } + + public void testHeaderClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Table.class, HeaderClickEvent.class, + HeaderClickListener.class); + } + + public void testColumnReorderListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Table.class, ColumnReorderEvent.class, + ColumnReorderListener.class); + } +} \ 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 index 0000000000..36cbf2d0b0 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.tabsheet; + +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; +import com.vaadin.ui.TabSheet.SelectedTabChangeListener; + +public class TabSheetListeners extends ListenerMethods { + public void testSelectedTabChangeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(TabSheet.class, SelectedTabChangeEvent.class, + SelectedTabChangeListener.class); + } +} 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 index 0000000000..43651b7445 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/tree/TreeListeners.java @@ -0,0 +1,27 @@ +package com.vaadin.tests.server.component.tree; + +import com.vaadin.event.ItemClickEvent; +import com.vaadin.event.ItemClickEvent.ItemClickListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Tree; +import com.vaadin.ui.Tree.CollapseEvent; +import com.vaadin.ui.Tree.CollapseListener; +import com.vaadin.ui.Tree.ExpandEvent; +import com.vaadin.ui.Tree.ExpandListener; + +public class TreeListeners extends ListenerMethods { + public void testExpandListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Tree.class, ExpandEvent.class, + ExpandListener.class); + } + + public void testItemClickListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Tree.class, ItemClickEvent.class, + ItemClickListener.class); + } + + public void testCollapseListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Tree.class, CollapseEvent.class, + CollapseListener.class); + } +} \ 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 index 0000000000..07dc64e34e --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/upload/UploadListeners.java @@ -0,0 +1,41 @@ +package com.vaadin.tests.server.component.upload; + +import com.vaadin.terminal.StreamVariable.StreamingProgressEvent; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Upload; +import com.vaadin.ui.Upload.FailedEvent; +import com.vaadin.ui.Upload.FailedListener; +import com.vaadin.ui.Upload.FinishedEvent; +import com.vaadin.ui.Upload.FinishedListener; +import com.vaadin.ui.Upload.ProgressListener; +import com.vaadin.ui.Upload.StartedEvent; +import com.vaadin.ui.Upload.StartedListener; +import com.vaadin.ui.Upload.SucceededEvent; +import com.vaadin.ui.Upload.SucceededListener; + +public class UploadListeners extends ListenerMethods { + public void testProgressListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Upload.class, StreamingProgressEvent.class, + ProgressListener.class); + } + + public void testSucceededListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Upload.class, SucceededEvent.class, + SucceededListener.class); + } + + public void testStartedListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Upload.class, StartedEvent.class, + StartedListener.class); + } + + public void testFailedListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Upload.class, FailedEvent.class, + FailedListener.class); + } + + public void testFinishedListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Upload.class, FinishedEvent.class, + FinishedListener.class); + } +} 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 index 0000000000..fa5c087275 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/urifragmentutility/UriFragmentUtilityListeners.java @@ -0,0 +1,13 @@ +package com.vaadin.tests.server.component.urifragmentutility; + +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.UriFragmentUtility; +import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent; +import com.vaadin.ui.UriFragmentUtility.FragmentChangedListener; + +public class UriFragmentUtilityListeners extends ListenerMethods { + public void testFragmentChangedListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(UriFragmentUtility.class, + FragmentChangedEvent.class, FragmentChangedListener.class); + } +} 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 index 0000000000..349d53c311 --- /dev/null +++ b/tests/src/com/vaadin/tests/server/component/window/WindowListeners.java @@ -0,0 +1,34 @@ +package com.vaadin.tests.server.component.window; + +import com.vaadin.event.FieldEvents.BlurEvent; +import com.vaadin.event.FieldEvents.BlurListener; +import com.vaadin.event.FieldEvents.FocusEvent; +import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.tests.server.component.ListenerMethods; +import com.vaadin.ui.Window; +import com.vaadin.ui.Window.CloseEvent; +import com.vaadin.ui.Window.CloseListener; +import com.vaadin.ui.Window.ResizeEvent; +import com.vaadin.ui.Window.ResizeListener; + +public class WindowListeners extends ListenerMethods { + public void testFocusListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Window.class, FocusEvent.class, + FocusListener.class); + } + + public void testBlurListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Window.class, BlurEvent.class, + BlurListener.class); + } + + public void testResizeListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Window.class, ResizeEvent.class, + ResizeListener.class); + } + + public void testCloseListenerAddGetRemove() throws Exception { + testListenerAddGetRemove(Window.class, CloseEvent.class, + CloseListener.class); + } +}