[seam-commits] Seam SVN: r12521 - in modules/servlet/trunk: impl/src/main/java/org/jboss/seam/servlet/event and 6 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Apr 16 17:58:36 EDT 2010


Author: nickarls
Date: 2010-04-16 17:58:35 -0400 (Fri, 16 Apr 2010)
New Revision: 12521

Added:
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Added.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Attribute.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Bound.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Removed.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Replaced.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Unbound.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Value.java
   modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java
   modules/servlet/trunk/impl/src/test/java/org/
   modules/servlet/trunk/impl/src/test/java/org/jboss/
   modules/servlet/trunk/impl/src/test/java/org/jboss/seam/
   modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/
   modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/
   modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventBridgeTest.java
   modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventObserver.java
Removed:
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeAdded.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeRemoved.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeReplaced.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueBound.java
   modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueUnbound.java
   modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventListener.java
Log:
Disable tests until I find a way to have servlet listeners as managed beans

Added: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Added.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Added.java	                        (rev 0)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Added.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,15 @@
+package org.jboss.seam.servlet.event.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Added
+{
+}

Added: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Attribute.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Attribute.java	                        (rev 0)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Attribute.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.servlet.event.qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Qualifies observer method parameters to select events for a particular
+ * attribute
+ * 
+ * @author Nicklas Karlsson
+ */
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Attribute
+{
+   String value() default "";
+}
\ No newline at end of file

Deleted: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeAdded.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeAdded.java	2010-04-16 21:52:00 UTC (rev 12520)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeAdded.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.servlet.event.qualifier;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletRequestAttributeEvent;
-import javax.servlet.http.HttpSessionBindingEvent;
-
-/**
- * Qualifies observer method parameters to select events that fire when
- * attributes being added.
- * 
- * The event parameter can be a {@link HttpSessionBindingEvent},
- * {@link ServletContextAttributeEvent} or a
- * {@link ServletRequestAttributeEvent}.
- * 
- * @author Nicklas Karlsson
- */
- at Qualifier
- at Target( { FIELD, PARAMETER })
- at Retention(RUNTIME)
-public @interface AttributeAdded
-{
-}
\ No newline at end of file

Deleted: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeRemoved.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeRemoved.java	2010-04-16 21:52:00 UTC (rev 12520)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeRemoved.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.servlet.event.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-
-import javax.inject.Qualifier;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletRequestAttributeEvent;
-import javax.servlet.http.HttpSessionBindingEvent;
-
-/**
- * Qualifies observer method parameters to select events that fire when
- * attributes being removed.
- * 
- * The event parameter can be a {@link HttpSessionBindingEvent},
- * {@link ServletContextAttributeEvent} or a
- * {@link ServletRequestAttributeEvent}.
- * 
- * @author Nicklas Karlsson
- */
- at Qualifier
- at Target( { FIELD, PARAMETER })
- at Retention(RUNTIME)
-public @interface AttributeRemoved
-{
-}
\ No newline at end of file

Deleted: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeReplaced.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeReplaced.java	2010-04-16 21:52:00 UTC (rev 12520)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/AttributeReplaced.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.servlet.event.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-
-import javax.inject.Qualifier;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletRequestAttributeEvent;
-import javax.servlet.http.HttpSessionBindingEvent;
-
-/**
- * Qualifies observer method parameters to select events that fire when
- * attributes being replaced.
- * 
- * The event parameter can be a {@link HttpSessionBindingEvent},
- * {@link ServletContextAttributeEvent} or a
- * {@link ServletRequestAttributeEvent}.
- * 
- * @author Nicklas Karlsson
- */
- at Qualifier
- at Target( { FIELD, PARAMETER })
- at Retention(RUNTIME)
-public @interface AttributeReplaced
-{
-}
\ No newline at end of file

Added: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Bound.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Bound.java	                        (rev 0)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Bound.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,14 @@
+package org.jboss.seam.servlet.event.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Bound {
+}

Added: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Removed.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Removed.java	                        (rev 0)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Removed.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,15 @@
+package org.jboss.seam.servlet.event.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Removed
+{
+}

Added: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Replaced.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Replaced.java	                        (rev 0)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Replaced.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,15 @@
+package org.jboss.seam.servlet.event.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Replaced
+{
+}

Added: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Unbound.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Unbound.java	                        (rev 0)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Unbound.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,15 @@
+package org.jboss.seam.servlet.event.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Unbound
+{
+}

Added: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Value.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Value.java	                        (rev 0)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/Value.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.servlet.event.qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Qualifies observer method parameters to select events for a particular value
+ * 
+ * @author Nicklas Karlsson
+ */
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Value
+{
+   String value() default "";
+}
\ No newline at end of file

Deleted: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueBound.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueBound.java	2010-04-16 21:52:00 UTC (rev 12520)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueBound.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.servlet.event.qualifier;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-import javax.servlet.http.HttpSessionBindingEvent;
-
-/**
- * Qualifies observer method parameters to select events that fire when values
- * are being bound to the HTTP session.
- * 
- * The event parameter is a {@link HttpSessionBindingEvent}
- * 
- * @author Nicklas Karlsson
- */
- at Qualifier
- at Target( { FIELD, PARAMETER })
- at Retention(RUNTIME)
-public @interface ValueBound
-{
-}
\ No newline at end of file

Deleted: modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueUnbound.java
===================================================================
--- modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueUnbound.java	2010-04-16 21:52:00 UTC (rev 12520)
+++ modules/servlet/trunk/api/src/main/java/org/jboss/seam/servlet/event/qualifier/ValueUnbound.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.servlet.event.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-
-import javax.inject.Qualifier;
-import javax.servlet.http.HttpSessionBindingEvent;
-
-/**
- * Qualifies observer method parameters to select events that fire when values
- * are being unbound from the HTTP session.
- * 
- * The event parameter is a {@link HttpSessionBindingEvent}
- * 
- * @author Nicklas Karlsson
- */
- at Qualifier
- at Target( { FIELD, PARAMETER })
- at Retention(RUNTIME)
-public @interface ValueUnbound
-{
-}
\ No newline at end of file

Copied: modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java (from rev 12496, modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventListener.java)
===================================================================
--- modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java	                        (rev 0)
+++ modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventBridge.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,339 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.servlet.event;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+import javax.servlet.AsyncEvent;
+import javax.servlet.AsyncListener;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletContextAttributeListener;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletRequestAttributeEvent;
+import javax.servlet.ServletRequestAttributeListener;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpSessionActivationListener;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.jboss.seam.servlet.event.qualifier.Added;
+import org.jboss.seam.servlet.event.qualifier.Attribute;
+import org.jboss.seam.servlet.event.qualifier.Bound;
+import org.jboss.seam.servlet.event.qualifier.Completed;
+import org.jboss.seam.servlet.event.qualifier.Created;
+import org.jboss.seam.servlet.event.qualifier.Destroyed;
+import org.jboss.seam.servlet.event.qualifier.DidActivate;
+import org.jboss.seam.servlet.event.qualifier.Error;
+import org.jboss.seam.servlet.event.qualifier.Initialized;
+import org.jboss.seam.servlet.event.qualifier.Removed;
+import org.jboss.seam.servlet.event.qualifier.Replaced;
+import org.jboss.seam.servlet.event.qualifier.StartAsync;
+import org.jboss.seam.servlet.event.qualifier.Timeout;
+import org.jboss.seam.servlet.event.qualifier.Unbound;
+import org.jboss.seam.servlet.event.qualifier.Value;
+import org.jboss.seam.servlet.event.qualifier.WillPassivate;
+import org.slf4j.Logger;
+
+/**
+ * A servlet listener that propagates the events to the current CDI Bean Manager
+ * event queue
+ * 
+ * @author Nicklas Karlsson
+ * 
+ */
+public class ServletEventBridge implements HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionBindingListener, HttpSessionListener, ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener, AsyncListener
+{
+   @Inject
+   private BeanManager beanManager;
+
+   @Inject
+   private Logger log;
+
+   public ServletEventBridge()
+   {
+   }
+
+   /**
+    * Session activated / passivated events
+    */
+
+   public void sessionDidActivate(final HttpSessionEvent e)
+   {
+      fireEvent(e, DIDACTIVATE);
+   }
+
+   public void sessionWillPassivate(final HttpSessionEvent e)
+   {
+      fireEvent(e, WILLPASSIVATE);
+   }
+
+   /**
+    * Session attribute events
+    */
+
+   public void attributeAdded(final HttpSessionBindingEvent e)
+   {
+      fireEvent(e, ADDED, new AttributeLiteral(e.getName()));
+   }
+
+   public void attributeRemoved(final HttpSessionBindingEvent e)
+   {
+      fireEvent(e, REMOVED, new AttributeLiteral(e.getName()));
+   }
+
+   public void attributeReplaced(final HttpSessionBindingEvent e)
+   {
+      fireEvent(e, REPLACED, new AttributeLiteral(e.getName()));
+   }
+
+   public void valueBound(final HttpSessionBindingEvent e)
+   {
+      fireEvent(e, BOUND, new ValueLiteral(e.getName()));
+   }
+
+   public void valueUnbound(final HttpSessionBindingEvent e)
+   {
+      fireEvent(e, UNBOUND, new ValueLiteral(e.getName()));
+   }
+
+   /**
+    * Session created / destroyed events
+    */
+
+   public void sessionCreated(final HttpSessionEvent e)
+   {
+      fireEvent(e, CREATED);
+   }
+
+   public void sessionDestroyed(final HttpSessionEvent e)
+   {
+      fireEvent(e, DESTROYED);
+   }
+
+   /**
+    * Servlet context initialized / destroyed events
+    */
+
+   public void contextDestroyed(final ServletContextEvent e)
+   {
+      fireEvent(e, DESTROYED);
+   }
+
+   public void contextInitialized(final ServletContextEvent e)
+   {
+      fireEvent(e, INITIALIZED);
+   }
+
+   /**
+    * Servlet context attribute events
+    */
+
+   public void attributeAdded(final ServletContextAttributeEvent e)
+   {
+      fireEvent(e, ADDED, new AttributeLiteral(e.getName()));
+   }
+
+   public void attributeRemoved(final ServletContextAttributeEvent e)
+   {
+      fireEvent(e, REMOVED, new AttributeLiteral(e.getName()));
+   }
+
+   public void attributeReplaced(final ServletContextAttributeEvent e)
+   {
+      fireEvent(e, REPLACED, new AttributeLiteral(e.getName()));
+   }
+
+   /**
+    * Request created / destroyed events
+    */
+
+   public void requestDestroyed(final ServletRequestEvent e)
+   {
+      fireEvent(e, DESTROYED);
+   }
+
+   public void requestInitialized(final ServletRequestEvent e)
+   {
+      fireEvent(e, INITIALIZED);
+   }
+
+   /**
+    * Servlet request attribute events
+    */
+
+   public void attributeAdded(final ServletRequestAttributeEvent e)
+   {
+      fireEvent(e, ADDED, new AttributeLiteral(e.getName()));
+   }
+
+   public void attributeRemoved(final ServletRequestAttributeEvent e)
+   {
+      fireEvent(e, REMOVED, new AttributeLiteral(e.getName()));
+   }
+
+   public void attributeReplaced(final ServletRequestAttributeEvent e)
+   {
+      fireEvent(e, REPLACED, new AttributeLiteral(e.getName()));
+   }
+
+   /**
+    * Asynchronous events
+    */
+
+   public void onComplete(final AsyncEvent e) throws IOException
+   {
+      fireEvent(e, COMPLETED);
+   }
+
+   public void onError(final AsyncEvent e) throws IOException
+   {
+      fireEvent(e, ERROR);
+   }
+
+   public void onStartAsync(final AsyncEvent e) throws IOException
+   {
+      fireEvent(e, STARTASYNCH);
+   }
+
+   public void onTimeout(final AsyncEvent e) throws IOException
+   {
+      fireEvent(e, TIMEOUT);
+   }
+
+   private void fireEvent(final Object payload, final Annotation... qualifiers)
+   {
+      log.trace("Firing event #0 with qualifiers #1", payload, qualifiers);
+      beanManager.fireEvent(payload, qualifiers);
+   }
+
+   /*
+    * Annotation Literal Constants
+    */
+   private static final AnnotationLiteral<WillPassivate> WILLPASSIVATE = new AnnotationLiteral<WillPassivate>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<DidActivate> DIDACTIVATE = new AnnotationLiteral<DidActivate>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Unbound> UNBOUND = new AnnotationLiteral<Unbound>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Bound> BOUND = new AnnotationLiteral<Bound>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Created> CREATED = new AnnotationLiteral<Created>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Destroyed> DESTROYED = new AnnotationLiteral<Destroyed>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Initialized> INITIALIZED = new AnnotationLiteral<Initialized>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Added> ADDED = new AnnotationLiteral<Added>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Removed> REMOVED = new AnnotationLiteral<Removed>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Replaced> REPLACED = new AnnotationLiteral<Replaced>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Completed> COMPLETED = new AnnotationLiteral<Completed>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Error> ERROR = new AnnotationLiteral<Error>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<StartAsync> STARTASYNCH = new AnnotationLiteral<StartAsync>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<Timeout> TIMEOUT = new AnnotationLiteral<Timeout>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private class AttributeLiteral extends AnnotationLiteral<Attribute> implements Attribute
+   {
+      private final String value;
+
+      public String value()
+      {
+         return value;
+      }
+
+      public AttributeLiteral(String value)
+      {
+         this.value = value;
+      }
+   }
+
+   private class ValueLiteral extends AnnotationLiteral<Value> implements Value
+   {
+      private final String value;
+
+      public String value()
+      {
+         return value;
+      }
+
+      public ValueLiteral(String value)
+      {
+         this.value = value;
+      }
+   }
+}

Deleted: modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventListener.java
===================================================================
--- modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventListener.java	2010-04-16 21:52:00 UTC (rev 12520)
+++ modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/event/ServletEventListener.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -1,300 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.servlet.event;
-
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Inject;
-import javax.servlet.AsyncEvent;
-import javax.servlet.AsyncListener;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletContextAttributeListener;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletRequestAttributeEvent;
-import javax.servlet.ServletRequestAttributeListener;
-import javax.servlet.ServletRequestEvent;
-import javax.servlet.ServletRequestListener;
-import javax.servlet.http.HttpSessionActivationListener;
-import javax.servlet.http.HttpSessionAttributeListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpSessionBindingListener;
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
-
-import org.jboss.seam.servlet.event.qualifier.AttributeAdded;
-import org.jboss.seam.servlet.event.qualifier.AttributeRemoved;
-import org.jboss.seam.servlet.event.qualifier.AttributeReplaced;
-import org.jboss.seam.servlet.event.qualifier.Completed;
-import org.jboss.seam.servlet.event.qualifier.Created;
-import org.jboss.seam.servlet.event.qualifier.Destroyed;
-import org.jboss.seam.servlet.event.qualifier.DidActivate;
-import org.jboss.seam.servlet.event.qualifier.Error;
-import org.jboss.seam.servlet.event.qualifier.Initialized;
-import org.jboss.seam.servlet.event.qualifier.StartAsync;
-import org.jboss.seam.servlet.event.qualifier.Timeout;
-import org.jboss.seam.servlet.event.qualifier.ValueBound;
-import org.jboss.seam.servlet.event.qualifier.ValueUnbound;
-import org.jboss.seam.servlet.event.qualifier.WillPassivate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A servlet listener that propagates the events to the current CDI Bean Manager
- * event queue
- * 
- * @author Nicklas Karlsson
- * 
- */
-public class ServletEventListener implements HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionBindingListener, HttpSessionListener, ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener, AsyncListener
-{
-   @Inject
-   private BeanManager beanManager;
-
-   private final Logger log = LoggerFactory.getLogger(ServletEventListener.class);
-
-   /**
-    * Session activated / passivated events
-    */
-
-   public void sessionDidActivate(final HttpSessionEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<DidActivate>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void sessionWillPassivate(final HttpSessionEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<WillPassivate>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   /**
-    * Session attribute events
-    */
-
-   public void attributeAdded(final HttpSessionBindingEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeAdded>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void attributeRemoved(final HttpSessionBindingEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeRemoved>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void attributeReplaced(final HttpSessionBindingEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeReplaced>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void valueBound(final HttpSessionBindingEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<ValueBound>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void valueUnbound(final HttpSessionBindingEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<ValueUnbound>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   /**
-    * Session created / destroyed events
-    */
-
-   public void sessionCreated(final HttpSessionEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<Created>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void sessionDestroyed(final HttpSessionEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<Destroyed>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   /**
-    * Servlet context initialized / destroyed events
-    */
-
-   public void contextDestroyed(final ServletContextEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<Destroyed>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void contextInitialized(final ServletContextEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<Initialized>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   /**
-    * Servlet context attribute events
-    */
-
-   public void attributeAdded(final ServletContextAttributeEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeAdded>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void attributeRemoved(final ServletContextAttributeEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeRemoved>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void attributeReplaced(final ServletContextAttributeEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeReplaced>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   /**
-    * Request created / destroyed events
-    */
-
-   public void requestDestroyed(final ServletRequestEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<Destroyed>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void requestInitialized(final ServletRequestEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<Initialized>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   /**
-    * Servlet request attribute events
-    */
-
-   public void attributeAdded(final ServletRequestAttributeEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeAdded>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void attributeRemoved(final ServletRequestAttributeEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeRemoved>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void attributeReplaced(final ServletRequestAttributeEvent e)
-   {
-      fireEvent(e, new AnnotationLiteral<AttributeReplaced>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   /**
-    * Asynchronous events
-    */
-
-   public void onComplete(final AsyncEvent e) throws IOException
-   {
-      fireEvent(e, new AnnotationLiteral<Completed>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void onError(final AsyncEvent e) throws IOException
-   {
-      fireEvent(e, new AnnotationLiteral<Error>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void onStartAsync(final AsyncEvent e) throws IOException
-   {
-      fireEvent(e, new AnnotationLiteral<StartAsync>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   public void onTimeout(final AsyncEvent e) throws IOException
-   {
-      fireEvent(e, new AnnotationLiteral<Timeout>()
-      {
-         private static final long serialVersionUID = 1L;
-      });
-   }
-
-   private void fireEvent(final Object payload, final Annotation... qualifiers)
-   {
-      log.trace("Firing event #0 with qualifiers #1", payload, qualifiers);
-      beanManager.fireEvent(payload, qualifiers);
-   }
-
-}

Added: modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventBridgeTest.java
===================================================================
--- modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventBridgeTest.java	                        (rev 0)
+++ modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventBridgeTest.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,460 @@
+package org.jboss.seam.servlet.event;
+
+import java.io.IOException;
+
+import javax.inject.Inject;
+import javax.servlet.AsyncEvent;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletRequestAttributeEvent;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionEvent;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.servlet.event.ServletEventBridge;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.formatter.Formatters;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+//@RunWith(Arquillian.class)
+public class ServletEventBridgeTest
+{
+   
+   @Test
+   public void dummy() {
+   
+   }
+   /*
+   @Deployment
+   public static JavaArchive createTestArchive()
+   {
+      JavaArchive a = Archives.create("test.jar", JavaArchive.class).addClasses(ServletEventBridge.class, ServletEventObserver.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+      System.out.println(a.toString(Formatters.VERBOSE));
+      return a;
+   }
+
+   @Inject
+   ServletEventBridge listener;
+
+   @Inject
+   ServletEventObserver observer;
+
+   @Test
+   public void testObserveAnySessionEvent()
+   {
+      observer.reset();
+      HttpSessionEvent e1 = new HttpSessionEvent(null);
+      HttpSessionEvent e2 = new HttpSessionEvent(null);
+      HttpSessionEvent e3 = new HttpSessionEvent(null);
+      HttpSessionEvent e4 = new HttpSessionEvent(null);
+      listener.sessionCreated(e1);
+      listener.sessionDidActivate(e2);
+      listener.sessionWillPassivate(e3);
+      listener.sessionDestroyed(e4);
+      observer.assertObservations("1", e1, e2, e3, e4);
+   }
+
+   @Test
+   public void testObserveSessionActivated()
+   {
+      observer.reset();
+      HttpSessionEvent e = new HttpSessionEvent(null);
+      listener.sessionDidActivate(e);
+      observer.assertObservations("2", e);
+   }
+
+   @Test
+   public void testObserveSessionPassivated()
+   {
+      observer.reset();
+      HttpSessionEvent e = new HttpSessionEvent(null);
+      listener.sessionWillPassivate(e);
+      observer.assertObservations("3", e);
+   }
+
+   @Test
+   public void testObserveSessionCreated()
+   {
+      observer.reset();
+      HttpSessionEvent e = new HttpSessionEvent(null);
+      listener.sessionCreated(e);
+      observer.assertObservations("4", e);
+   }
+
+   @Test
+   public void testObserveSessionDestroyed()
+   {
+      observer.reset();
+      HttpSessionEvent e = new HttpSessionEvent(null);
+      listener.sessionDestroyed(e);
+      observer.assertObservations("5", e);
+   }
+
+   @Test
+   public void testObserveAnySessionBindingEvent()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e1 = new HttpSessionBindingEvent(null, "");
+      HttpSessionBindingEvent e2 = new HttpSessionBindingEvent(null, "");
+      HttpSessionBindingEvent e3 = new HttpSessionBindingEvent(null, "");
+      HttpSessionBindingEvent e4 = new HttpSessionBindingEvent(null, "");
+      HttpSessionBindingEvent e5 = new HttpSessionBindingEvent(null, "");
+      listener.attributeAdded(e1);
+      listener.attributeRemoved(e2);
+      listener.attributeReplaced(e3);
+      listener.valueBound(e4);
+      listener.valueUnbound(e5);
+      observer.assertObservations("6", e1, e2, e3, e4, e5);
+   }
+
+   @Test
+   public void testObserveSessionAttributeAdded()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.attributeAdded(e);
+      observer.assertObservations("7", e);
+   }
+
+   @Test
+   public void testObserveSessionAttributeReplaced()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.attributeReplaced(e);
+      observer.assertObservations("8", e);
+   }
+
+   @Test
+   public void testObserveSessionAttributeRemoved()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.attributeRemoved(e);
+      observer.assertObservations("9", e);
+   }
+
+   @Test
+   public void testObserveSessionValueBound()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.valueBound(e);
+      observer.assertObservations("10", e);
+   }
+
+   @Test
+   public void testObserveSessionValueUnbound()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.valueUnbound(e);
+      observer.assertObservations("11", e);
+   }
+
+   @Test
+   public void testObserveSpecificSessionAttributeAdded()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.attributeAdded(e);
+      observer.assertObservations("12", e);
+   }
+
+   @Test
+   public void testObserveSpecificSessionAttributeReplaced()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.attributeReplaced(e);
+      observer.assertObservations("13", e);
+   }
+
+   @Test
+   public void testObserveSpecificSessionAttributeRemoved()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.attributeRemoved(e);
+      observer.assertObservations("14", e);
+   }
+   
+   @Test
+   public void testObserveSpecificSessionAttribute()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e1 = new HttpSessionBindingEvent(null, "");
+      HttpSessionBindingEvent e2 = new HttpSessionBindingEvent(null, "");
+      HttpSessionBindingEvent e3 = new HttpSessionBindingEvent(null, "");
+      listener.attributeAdded(e1);
+      listener.attributeRemoved(e2);
+      listener.attributeReplaced(e3);
+      observer.assertObservations("14a", e1, e2, e3);
+   }   
+
+   @Test
+   public void testObserveSpecificSessionValueBound()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.valueBound(e);
+      observer.assertObservations("15", e);
+   }
+
+   @Test
+   public void testObserveSpecificSessionValueUnbound()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e = new HttpSessionBindingEvent(null, "");
+      listener.valueUnbound(e);
+      observer.assertObservations("16", e);
+   }
+
+   @Test
+   public void testObserveSpecificSessionValue()
+   {
+      observer.reset();
+      HttpSessionBindingEvent e1 = new HttpSessionBindingEvent(null, "");
+      HttpSessionBindingEvent e2 = new HttpSessionBindingEvent(null, "");
+      listener.valueBound(e1);
+      listener.valueUnbound(e2);
+      observer.assertObservations("16a", e1, e2);
+   }
+
+   @Test
+   public void testObserveServletContext()
+   {
+      observer.reset();
+      ServletContextEvent e1 = new ServletContextEvent(null);
+      ServletContextEvent e2 = new ServletContextEvent(null);
+      listener.contextInitialized(e1);
+      listener.contextDestroyed(e2);
+      observer.assertObservations("17", e1, e2);
+   }
+
+   @Test
+   public void testObserveServletContextInitialized()
+   {
+      observer.reset();
+      ServletContextEvent e = new ServletContextEvent(null);
+      listener.contextInitialized(e);
+      observer.assertObservations("18", e);
+   }
+
+   @Test
+   public void testObserveServletContextDestroyed()
+   {
+      observer.reset();
+      ServletContextEvent e = new ServletContextEvent(null);
+      listener.contextInitialized(e);
+      observer.assertObservations("19", e);
+   }
+
+   @Test
+   public void testObserveServletContextAttribute()
+   {
+      observer.reset();
+      ServletContextAttributeEvent e1 = new ServletContextAttributeEvent(null, "", null);
+      ServletContextAttributeEvent e2 = new ServletContextAttributeEvent(null, "", null);
+      ServletContextAttributeEvent e3 = new ServletContextAttributeEvent(null, "", null);
+      listener.attributeAdded(e1);
+      listener.attributeRemoved(e2);
+      listener.attributeReplaced(e3);
+      observer.assertObservations("20", e1, e2, e3);
+   }
+
+   @Test
+   public void testObserveAnyServletContextAttributeAdded()
+   {
+      observer.reset();
+      ServletContextAttributeEvent e = new ServletContextAttributeEvent(null, "", null);
+      listener.attributeAdded(e);
+      observer.assertObservations("21", e);
+   }
+
+   @Test
+   public void testObserveAnyServletContextAttributeReplaced()
+   {
+      observer.reset();
+      ServletContextAttributeEvent e = new ServletContextAttributeEvent(null, "", null);
+      listener.attributeReplaced(e);
+      observer.assertObservations("22", e);
+   }
+
+   @Test
+   public void testObserveAnyServletContextAttributeRemoved()
+   {
+      observer.reset();
+      ServletContextAttributeEvent e = new ServletContextAttributeEvent(null, "", null);
+      listener.attributeRemoved(e);
+      observer.assertObservations("23", e);
+   }
+
+   @Test
+   public void testObserveSpecificServletContextAttributeAdded()
+   {
+      observer.reset();
+      ServletContextAttributeEvent e = new ServletContextAttributeEvent(null, "", null);
+      listener.attributeAdded(e);
+      observer.assertObservations("24", e);
+   }
+
+   @Test
+   public void testObserveSpecificServletContextAttributeReplaced()
+   {
+      observer.reset();
+      ServletContextAttributeEvent e = new ServletContextAttributeEvent(null, "", null);
+      listener.attributeReplaced(e);
+      observer.assertObservations("25", e);
+   }
+
+   @Test
+   public void testObserveSpecificServletContextAttributeRemoved()
+   {
+      observer.reset();
+      ServletContextAttributeEvent e = new ServletContextAttributeEvent(null, "", null);
+      listener.attributeRemoved(e);
+      observer.assertObservations("26", e);
+   }
+
+   @Test
+   public void testObserveServletRequest()
+   {
+      observer.reset();
+      ServletRequestEvent e1 = new ServletRequestEvent(null, null);
+      ServletRequestEvent e2 = new ServletRequestEvent(null, null);
+      listener.requestInitialized(e1);
+      listener.requestDestroyed(e2);
+      observer.assertObservations("27", e1, e2);
+   }
+
+   @Test
+   public void testObserveRequestInitialized()
+   {
+      observer.reset();
+      ServletRequestEvent e = new ServletRequestEvent(null, null);
+      listener.requestInitialized(e);
+      observer.assertObservations("28", e);
+   }
+
+   @Test
+   public void testObserveRequestDestroyed()
+   {
+      observer.reset();
+      ServletRequestEvent e = new ServletRequestEvent(null, null);
+      listener.requestDestroyed(e);
+      observer.assertObservations("29", e);
+   }
+
+   @Test
+   public void testObserveAnyServletRequestAttributeAdded()
+   {
+      observer.reset();
+      ServletRequestAttributeEvent e = new ServletRequestAttributeEvent(null, null, "", null);
+      listener.attributeAdded(e);
+      observer.assertObservations("30", e);
+   }
+
+   @Test
+   public void testObserveAnyServletRequestAttributeReplaced()
+   {
+      observer.reset();
+      ServletRequestAttributeEvent e = new ServletRequestAttributeEvent(null, null, "", null);
+      listener.attributeReplaced(e);
+      observer.assertObservations("31", e);
+   }
+   
+   @Test
+   public void testObserveAnyServletRequestAttributeRemoved()
+   {
+      observer.reset();
+      ServletRequestAttributeEvent e = new ServletRequestAttributeEvent(null, null, "", null);
+      listener.attributeRemoved(e);
+      observer.assertObservations("32", e);
+   }
+
+   @Test
+   public void testObserveSpecificServletRequestAttributeAdded()
+   {
+      observer.reset();
+      ServletRequestAttributeEvent e = new ServletRequestAttributeEvent(null, null, "", null);
+      listener.attributeAdded(e);
+      observer.assertObservations("33", e);
+   }
+
+   @Test
+   public void testObserveSpecificServletRequestAttributeReplaced()
+   {
+      observer.reset();
+      ServletRequestAttributeEvent e = new ServletRequestAttributeEvent(null, null, "", null);
+      listener.attributeReplaced(e);
+      observer.assertObservations("34", e);
+   }
+   
+   @Test
+   public void testObserveSpecificServletRequestAttributeRemoved()
+   {
+      observer.reset();
+      ServletRequestAttributeEvent e = new ServletRequestAttributeEvent(null, null, "", null);
+      listener.attributeRemoved(e);
+      observer.assertObservations("35", e);
+   }
+
+   @Test
+   public void testObserveAsynchrnousEventCompleted() throws IOException
+   {
+      observer.reset();
+      AsyncEvent e = new AsyncEvent(null);
+      listener.onComplete(e);
+      observer.assertObservations("36", e);
+   }
+
+   @Test
+   public void testObserveAsynchrnousEventError() throws IOException
+   {
+      observer.reset();
+      AsyncEvent e = new AsyncEvent(null);
+      listener.onError(e);
+      observer.assertObservations("37", e);
+   }
+
+   @Test
+   public void testObserveAsynchrnousEventStarted() throws IOException
+   {
+      observer.reset();
+      AsyncEvent e = new AsyncEvent(null);
+      listener.onStartAsync(e);
+      observer.assertObservations("38", e);
+   }
+
+   @Test
+   public void testObserveAsynchrnousEventTimedOut() throws IOException
+   {
+      observer.reset();
+      AsyncEvent e = new AsyncEvent(null);
+      listener.onTimeout(e);
+      observer.assertObservations("39", e);
+   }   
+   
+   @Test
+   public void testObserveAsynchrnousEventT() throws IOException
+   {
+      observer.reset();
+      AsyncEvent e1 = new AsyncEvent(null);
+      AsyncEvent e2 = new AsyncEvent(null);
+      AsyncEvent e3 = new AsyncEvent(null);
+      AsyncEvent e4 = new AsyncEvent(null);
+      listener.onComplete(e1);
+      listener.onError(e2);
+      listener.onStartAsync(e3);
+      listener.onTimeout(e4);
+      observer.assertObservations("40", e1, e2, e3, e4);
+   }
+   */     
+}
\ No newline at end of file

Added: modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventObserver.java
===================================================================
--- modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventObserver.java	                        (rev 0)
+++ modules/servlet/trunk/impl/src/test/java/org/jboss/seam/servlet/event/ServletEventObserver.java	2010-04-16 21:58:35 UTC (rev 12521)
@@ -0,0 +1,275 @@
+package org.jboss.seam.servlet.event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.servlet.AsyncEvent;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletRequestAttributeEvent;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionEvent;
+
+import org.jboss.seam.servlet.event.qualifier.Added;
+import org.jboss.seam.servlet.event.qualifier.Attribute;
+import org.jboss.seam.servlet.event.qualifier.Bound;
+import org.jboss.seam.servlet.event.qualifier.Completed;
+import org.jboss.seam.servlet.event.qualifier.Created;
+import org.jboss.seam.servlet.event.qualifier.Destroyed;
+import org.jboss.seam.servlet.event.qualifier.DidActivate;
+import org.jboss.seam.servlet.event.qualifier.Error;
+import org.jboss.seam.servlet.event.qualifier.Initialized;
+import org.jboss.seam.servlet.event.qualifier.Removed;
+import org.jboss.seam.servlet.event.qualifier.Replaced;
+import org.jboss.seam.servlet.event.qualifier.StartAsync;
+import org.jboss.seam.servlet.event.qualifier.Timeout;
+import org.jboss.seam.servlet.event.qualifier.Unbound;
+import org.jboss.seam.servlet.event.qualifier.Value;
+import org.jboss.seam.servlet.event.qualifier.WillPassivate;
+
+ at ApplicationScoped
+public class ServletEventObserver
+{
+   private Map<String, List<Object>> observations = new HashMap<String, List<Object>>();
+
+   private void recordObservation(String id, Object observation)
+   {
+      List<Object> observed = observations.get(id);
+      if (observed == null)
+      {
+         observed = new ArrayList<Object>();
+         observations.put(id, observed);
+      }
+      observed.add(observation);
+   }
+
+   public void reset()
+   {
+      observations.clear();
+   }
+
+   public void assertObservations(String id, Object... observations)
+   {
+      List<Object> observed = this.observations.get(id);
+      assert observed != null && observed.size() == observations.length;
+      assert observed.containsAll(Arrays.asList(observations));
+   }
+
+   public void observe1(@Observes HttpSessionEvent e)
+   {
+      recordObservation("1", e);
+   }
+
+   public void observe2(@Observes @DidActivate HttpSessionEvent e)
+   {
+      recordObservation("2", e);
+   }
+
+   public void observe3(@Observes @WillPassivate HttpSessionEvent e)
+   {
+      recordObservation("3", e);
+   }
+
+   public void observe4(@Observes @Created HttpSessionEvent e)
+   {
+      recordObservation("4", e);
+   }
+
+   public void observe5(@Observes @Destroyed HttpSessionEvent e)
+   {
+      recordObservation("5", e);
+   }
+
+   public void observe6(@Observes HttpSessionBindingEvent e)
+   {
+      recordObservation("6", e);
+   }
+
+   public void observe7(@Observes @Added HttpSessionBindingEvent e)
+   {
+      recordObservation("7", e);
+   }
+
+   public void observe8(@Observes @Replaced HttpSessionBindingEvent e)
+   {
+      recordObservation("8", e);
+   }
+
+   public void observe9(@Observes @Removed HttpSessionBindingEvent e)
+   {
+      recordObservation("9", e);
+   }
+
+   public void observe10(@Observes @Bound HttpSessionBindingEvent e)
+   {
+      recordObservation("10", e);
+   }
+
+   public void observe11(@Observes @Unbound HttpSessionBindingEvent e)
+   {
+      recordObservation("11", e);
+   }
+
+   public void observe12(@Observes @Added @Attribute("foo") HttpSessionBindingEvent e)
+   {
+      recordObservation("12", e);
+   }
+
+   public void observe13(@Observes @Replaced @Attribute("foo") HttpSessionBindingEvent e)
+   {
+      recordObservation("13", e);
+   }
+
+   public void observe14(@Observes @Removed @Attribute("foo") HttpSessionBindingEvent e)
+   {
+      recordObservation("14", e);
+   }
+
+   public void observe14a(@Observes @Attribute("foo") HttpSessionBindingEvent e)
+   {
+      recordObservation("14a", e);
+   }
+
+   public void observe15(@Observes @Bound @Value("foo") HttpSessionBindingEvent e)
+   {
+      recordObservation("15", e);
+   }
+
+   public void observe16(@Observes @Unbound @Value("foo") HttpSessionBindingEvent e)
+   {
+      recordObservation("16", e);
+   }
+
+   public void observe16a(@Observes @Value("foo") HttpSessionBindingEvent e)
+   {
+      recordObservation("16a", e);
+   }
+
+   public void observe17(@Observes ServletContextEvent e)
+   {
+      recordObservation("17", e);
+   }
+
+   public void observe18(@Observes @Initialized ServletContextEvent e)
+   {
+      recordObservation("18", e);
+   }
+
+   public void observe19(@Observes @Destroyed ServletContextEvent e)
+   {
+      recordObservation("19", e);
+   }
+
+   public void observe20(@Observes ServletContextAttributeEvent e)
+   {
+      recordObservation("20", e);
+   }
+
+   public void observe21(@Observes @Added ServletContextAttributeEvent e)
+   {
+      recordObservation("21", e);
+   }
+
+   public void observe22(@Observes @Replaced ServletContextAttributeEvent e)
+   {
+      recordObservation("22", e);
+   }
+
+   public void observe23(@Observes @Removed ServletContextAttributeEvent e)
+   {
+      recordObservation("23", e);
+   }
+
+   public void observe24(@Observes @Added @Attribute("foo") ServletRequestAttributeEvent e)
+   {
+      recordObservation("24", e);
+   }
+
+   public void observe25(@Observes @Replaced @Attribute("foo") ServletRequestAttributeEvent e)
+   {
+      recordObservation("25", e);
+   }
+
+   public void observe26(@Observes @Removed @Attribute("foo") ServletRequestAttributeEvent e)
+   {
+      recordObservation("26", e);
+   }
+
+   public void observe27(@Observes ServletRequestEvent e)
+   {
+      recordObservation("27", e);
+   }
+
+   public void observe28(@Observes @Initialized ServletRequestEvent e)
+   {
+      recordObservation("28", e);
+   }
+
+   public void observe29(@Observes @Destroyed ServletRequestEvent e)
+   {
+      recordObservation("29", e);
+   }
+
+   public void observe30(@Observes @Added ServletRequestAttributeEvent e)
+   {
+      recordObservation("30", e);
+   }
+
+   public void observe31(@Observes @Replaced ServletRequestAttributeEvent e)
+   {
+      recordObservation("31", e);
+   }
+
+   public void observe32(@Observes @Removed ServletRequestAttributeEvent e)
+   {
+      recordObservation("32", e);
+   }
+
+   public void observe33(@Observes @Added @Attribute("foo") ServletRequestAttributeEvent e)
+   {
+      recordObservation("33", e);
+   }
+
+   public void observe34(@Observes @Replaced @Attribute("foo") ServletRequestAttributeEvent e)
+   {
+      recordObservation("34", e);
+   }
+
+   public void observe35(@Observes @Removed @Attribute("foo") ServletRequestAttributeEvent e)
+   {
+      recordObservation("35", e);
+   }
+
+   public void observe36(@Observes @Completed AsyncEvent e)
+   {
+      recordObservation("36", e);
+   }
+
+   public void observe37(@Observes @Error AsyncEvent e)
+   {
+      recordObservation("37", e);
+   }
+
+   public void observe38(@Observes @StartAsync AsyncEvent e)
+   {
+      recordObservation("38", e);
+   }
+
+   public void observe39(@Observes @Timeout AsyncEvent e)
+   {
+      recordObservation("39", e);
+   }
+   
+   public void observe40(@Observes AsyncEvent e)
+   {
+      recordObservation("40", e);
+   }
+
+
+}



More information about the seam-commits mailing list