[seam-commits] Seam SVN: r12245 - in modules/faces/trunk: src/main/java/org/jboss/seam/faces and 7 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Mar 22 21:52:46 EDT 2010


Author: lincolnthree
Date: 2010-03-22 21:52:45 -0400 (Mon, 22 Mar 2010)
New Revision: 12245

Added:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/cdi/
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/cdi/BeanManagerAware.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/AnyPhase.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/MockLogger.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java
Removed:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventListener.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventListener.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java
Modified:
   modules/faces/trunk/pom.xml
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java
   modules/faces/trunk/src/main/resources/META-INF/faces-config.xml
Log:
Refactored and documented the PhaseEventBridge, SystemEventBridge. Added unit tests.

Added the @AnyPhase annotation to allow a PhaseEvent observer to observe all phase events throughout thet lifecycle.

Modified: modules/faces/trunk/pom.xml
===================================================================
--- modules/faces/trunk/pom.xml	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/pom.xml	2010-03-23 01:52:45 UTC (rev 12245)
@@ -2,17 +2,41 @@
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 
-	<artifactId>seam-faces</artifactId>
-	<version>3.0.0-SNAPSHOT</version>
-	<packaging>jar</packaging>
-	<name>Seam Faces Module</name>
-
 	<parent>
 		<artifactId>seam-parent</artifactId>
 		<groupId>org.jboss.seam</groupId>
 		<version>3.0.0-SNAPSHOT</version>
 	</parent>
 
+	<artifactId>seam-faces</artifactId>
+	<version>3.0.0-SNAPSHOT</version>
+
+	<packaging>jar</packaging>
+	<name>Seam Faces Module</name>
+
+	<developers>
+		<developer>
+			<name>Lincoln Baxter, III</name>
+			<email>lincolnbaxter at gmail.com</email>
+			<url>http://ocpsoft.com</url>
+			<organization>JBoss, by Red Hat</organization>
+			<organizationUrl>http://jboss.org</organizationUrl>
+			<timezone>EST</timezone>
+			<roles>
+				<role>Project Lead</role>
+			</roles>
+		</developer>
+		<developer>
+			<name>Dan J. Allen</name>
+			<organization>JBoss, by Red Hat</organization>
+			<organizationUrl>http://jboss.org</organizationUrl>
+			<timezone>EST</timezone>
+			<roles>
+				<role>Project Lead</role>
+			</roles>
+		</developer>
+	</developers>
+
 	<properties>
 		<arquillian.version>1.0.0.Alpha1</arquillian.version>
 		<jsfmock.version>1.0.0</jsfmock.version>
@@ -23,7 +47,8 @@
 		<repository>
 			<id>oss.sonatype.org/jboss-snapshots</id>
 			<name>JBoss (Nexus) Snapshots Repository</name>
-			<url>http://oss.sonatype.org/content/repositories/jboss-snapshots</url>
+			<url>http://oss.sonatype.org/content/repositories/jboss-snapshots
+			</url>
 			<releases>
 				<enabled>false</enabled>
 			</releases>
@@ -32,18 +57,6 @@
 				<updatePolicy>never</updatePolicy>
 			</snapshots>
 		</repository>
-		<repository>
-			<id>snapshots.jboss.org</id>
-			<name>JBoss Snapshots Repository</name>
-			<url>http://snapshots.jboss.org/maven2</url>
-			<releases>
-				<enabled>false</enabled>
-			</releases>
-			<snapshots>
-				<enabled>true</enabled>
-				<updatePolicy>never</updatePolicy>
-			</snapshots>
-		</repository>
 
 		<repository>
 			<id>Java.NET</id>
@@ -54,6 +67,7 @@
 
 	<dependencies>
 
+		<!-- Environment Dependencies -->
 		<dependency>
 			<!-- This is necessary until a new JSF-API is published to central -->
 			<groupId>com.sun.faces</groupId>
@@ -71,41 +85,43 @@
 			<artifactId>jsr250-api</artifactId>
 			<scope>provided</scope>
 		</dependency>
+		<dependency>
+			<groupId>org.jboss.weld</groupId>
+			<artifactId>weld-extensions</artifactId>
+			<version>1.0.0.Alpha1</version>
+		</dependency>
 
+		<!-- Test Dependencies -->
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>4.6</version>
+			<version>4.8.1</version>
 			<scope>test</scope>
 		</dependency>
-
 		<dependency>
 			<groupId>org.jboss.arquillian</groupId>
 			<artifactId>arquillian-junit</artifactId>
 			<version>${arquillian.version}</version>
 			<scope>test</scope>
 		</dependency>
-
 		<dependency>
 			<groupId>org.jboss.arquillian.container</groupId>
 			<artifactId>arquillian-weld-embedded</artifactId>
 			<version>${arquillian.version}</version>
 		</dependency>
-
 		<dependency>
+			<groupId>org.jboss.jsfunit</groupId>
+			<artifactId>jboss-jsfunit-core</artifactId>
+			<version>1.2.0.Final</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
 			<groupId>org.jboss.test-jsf</groupId>
 			<artifactId>jsf-mock</artifactId>
 			<version>${jsfmock.version}</version>
 			<scope>test</scope>
 		</dependency>
 
-		<dependency>
-			<groupId>org.jboss.jsfunit</groupId>
-			<artifactId>jboss-jsfunit-core</artifactId>
-			<version>1.2.0.Final</version>
-			<scope>test</scope>
-		</dependency>
-
 	</dependencies>
 
 	<profiles>
@@ -122,8 +138,8 @@
 	</profiles>
 
 	<scm>
-		<connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/faces/trunk</connection>
-		<developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/faces/trunk</developerConnection>
+		<connection>scm:svn:http://anonsvn.jboss.org/repos/seam/modules/faces/trunk </connection>
+		<developerConnection>scm:svn:https://svn.jboss.org/repos/seam/modules/faces/trunk </developerConnection>
 		<url>http://fisheye.jboss.org/browse/Seam/modules/faces/trunk</url>
 	</scm>
 

Copied: modules/faces/trunk/src/main/java/org/jboss/seam/faces/cdi/BeanManagerAware.java (from rev 12236, modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java)
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/cdi/BeanManagerAware.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/cdi/BeanManagerAware.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,50 @@
+package org.jboss.seam.faces.cdi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class BeanManagerAware
+{
+   @Inject
+   BeanManager beanManager;
+
+   // FIXME: hack to work around invalid binding in JBoss AS 6 M2
+   private static final List<String> beanManagerLocations;
+
+   static
+   {
+      beanManagerLocations = new ArrayList<String>();
+      beanManagerLocations.add("java:comp/BeanManager");
+      beanManagerLocations.add("java:app/BeanManager");
+   }
+
+   protected BeanManager getBeanManager()
+   {
+      if (beanManager == null)
+      {
+         beanManager = lookupBeanManager();
+      }
+      return beanManager;
+   }
+
+   private BeanManager lookupBeanManager()
+   {
+      for (String location : beanManagerLocations)
+      {
+         try
+         {
+            return (BeanManager) new InitialContext().lookup(location);
+         }
+         catch (NamingException e)
+         {
+            // No panic, keep trying
+         }
+      }
+      throw new IllegalArgumentException("Could not find BeanManager in " + beanManagerLocations);
+   }
+}

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/MethodBindingMethodExpressionAdapter.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -41,6 +41,7 @@
 import javax.faces.context.FacesContext;
 import javax.faces.el.EvaluationException;
 import javax.faces.el.MethodBinding;
+import javax.faces.el.MethodNotFoundException;
 
 import javax.el.MethodExpression;
 import javax.el.MethodInfo;
@@ -69,13 +70,14 @@
    {
    } // for StateHolder
 
-   MethodBindingMethodExpressionAdapter(MethodExpression methodExpression)
+   MethodBindingMethodExpressionAdapter(final MethodExpression methodExpression)
    {
       this.methodExpression = methodExpression;
    }
 
    @Override
-   public Object invoke(FacesContext context, Object params[]) throws javax.faces.el.EvaluationException, javax.faces.el.MethodNotFoundException
+   @SuppressWarnings("deprecation")
+   public Object invoke(final FacesContext context, final Object params[]) throws EvaluationException, MethodNotFoundException
    {
       assert (null != methodExpression);
       if (context == null)
@@ -107,20 +109,21 @@
       }
       catch (NullPointerException e)
       {
-         throw new javax.faces.el.MethodNotFoundException(e);
+         throw new MethodNotFoundException(e);
       }
       return result;
    }
 
    @Override
-   public Class getType(FacesContext context) throws javax.faces.el.MethodNotFoundException
+   @SuppressWarnings("deprecation")
+   public Class<?> getType(final FacesContext context) throws MethodNotFoundException
    {
       assert (null != methodExpression);
       if (context == null)
       {
          throw new NullPointerException("FacesConext -> null");
       }
-      Class result = null;
+      Class<?> result = null;
       if (context == null)
       {
          throw new NullPointerException();
@@ -133,15 +136,15 @@
       }
       catch (javax.el.PropertyNotFoundException e)
       {
-         throw new javax.faces.el.MethodNotFoundException(e);
+         throw new MethodNotFoundException(e);
       }
       catch (javax.el.MethodNotFoundException e)
       {
-         throw new javax.faces.el.MethodNotFoundException(e);
+         throw new MethodNotFoundException(e);
       }
       catch (ELException e)
       {
-         throw new javax.faces.el.MethodNotFoundException(e);
+         throw new MethodNotFoundException(e);
       }
       return result;
    }
@@ -154,7 +157,8 @@
    }
 
    @Override
-   public boolean equals(Object other)
+   @SuppressWarnings("deprecation")
+   public boolean equals(final Object other)
    {
       if (this == other)
       {
@@ -206,7 +210,7 @@
          // Get all of the methods with the matching name and try
          // to find a match based on controlInfo's return and parameter
          // types
-         Class type = binding.getType(context);
+         Class<?> type = binding.getType(context);
          Method[] methods = result.getClass().getMethods();
          for (Method meth : methods)
          {
@@ -234,12 +238,12 @@
       return this.tranzient;
    }
 
-   public void setTransient(boolean tranzient)
+   public void setTransient(final boolean tranzient)
    {
       this.tranzient = tranzient;
    }
 
-   public Object saveState(FacesContext context)
+   public Object saveState(final FacesContext context)
    {
       if (context == null)
       {
@@ -269,7 +273,7 @@
 
    }
 
-   public void restoreState(FacesContext context, Object state)
+   public void restoreState(final FacesContext context, final Object state)
    {
       if (context == null)
       {
@@ -288,7 +292,7 @@
          String className = stateStruct[1].toString();
          MethodExpression result = null;
 
-         Class toRestoreClass = null;
+         Class<?> toRestoreClass = null;
          if (null != className)
          {
             try
@@ -316,7 +320,7 @@
                }
             }
 
-            if (null != result && null != savedState)
+            if ((null != result) && (null != savedState))
             {
                // don't need to check transient, since that was
                // done on the saving side.
@@ -339,7 +343,7 @@
    //
    // Helper methods for StateHolder
    //
-   private static Class loadClass(String name, Object fallbackClass) throws ClassNotFoundException
+   private static Class<?> loadClass(final String name, final Object fallbackClass) throws ClassNotFoundException
    {
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
       if (loader == null)

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/component/UIViewAction.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -139,7 +139,7 @@
       {
       }
 
-      PropertyKeys(String name)
+      PropertyKeys(final String name)
       {
          this.name = name;
       }
@@ -175,6 +175,7 @@
     * 
     * @deprecated This has been replaced by {@link #getActionExpression}.
     */
+   @Deprecated
    public MethodBinding getAction()
    {
       MethodBinding result = null;
@@ -194,7 +195,8 @@
     *             {@link #setActionExpression(javax.el.MethodExpression)}.
     * @throws UnsupportedOperationException if called
     */
-   public void setAction(MethodBinding action)
+   @Deprecated
+   public void setAction(final MethodBinding action)
    {
       throw new UnsupportedOperationException("Not supported.");
    }
@@ -204,6 +206,7 @@
     * 
     * @throws UnsupportedOperationException if called
     */
+   @SuppressWarnings("deprecation")
    public MethodBinding getActionListener()
    {
       throw new UnsupportedOperationException("Not supported.");
@@ -214,7 +217,8 @@
     * 
     * @throws UnsupportedOperationException if called
     */
-   public void setActionListener(MethodBinding actionListener)
+   @SuppressWarnings("deprecation")
+   public void setActionListener(final MethodBinding actionListener)
    {
       throw new UnsupportedOperationException("Not supported.");
    }
@@ -235,7 +239,7 @@
     * Sets the immediate flag, which controls the JSF lifecycle in which the
     * action is invoked.
     */
-   public void setImmediate(boolean immediate)
+   public void setImmediate(final boolean immediate)
    {
       getStateHelper().put(PropertyKeys.immediate, immediate);
    }
@@ -268,7 +272,7 @@
    /**
     * Set the name of the phase in which the action is to be queued.
     */
-   public void setPhase(String phase)
+   public void setPhase(final String phase)
    {
       getStateHelper().put(PropertyKeys.phase, phase);
    }
@@ -311,7 +315,7 @@
     * 
     * @throws UnsupportedOperationException if called
     */
-   public void addActionListener(ActionListener listener)
+   public void addActionListener(final ActionListener listener)
    {
       throw new UnsupportedOperationException("Not supported.");
    }
@@ -329,7 +333,7 @@
     * 
     * @throws UnsupportedOperationException if called
     */
-   public void removeActionListener(ActionListener listener)
+   public void removeActionListener(final ActionListener listener)
    {
       throw new UnsupportedOperationException("Not supported.");
    }
@@ -345,7 +349,7 @@
    /**
     * Sets the action, represented as an EL method expression, to invoke.
     */
-   public void setActionExpression(MethodExpression actionExpression)
+   public void setActionExpression(final MethodExpression actionExpression)
    {
       getStateHelper().put(PropertyKeys.actionExpression, actionExpression);
    }
@@ -363,7 +367,7 @@
     * Set the bookean flag that controls whether the action is invoked during a
     * faces (postback) request.
     */
-   public void setOnPostback(boolean onPostback)
+   public void setOnPostback(final boolean onPostback)
    {
       getStateHelper().put(PropertyKeys.onPostback, onPostback);
    }
@@ -381,7 +385,7 @@
     * Sets the condition, represented as an EL value expression, that must
     * evaluate to true for the action to be invoked.
     */
-   public void setIf(boolean condition)
+   public void setIf(final boolean condition)
    {
       getStateHelper().put(PropertyKeys.ifAttr, condition);
    }
@@ -405,7 +409,7 @@
     * @throws NullPointerException if <code>event</code> is <code>null</code>
     */
    @Override
-   public void broadcast(FacesEvent event) throws AbortProcessingException
+   public void broadcast(final FacesEvent event) throws AbortProcessingException
    {
 
       super.broadcast(event);
@@ -417,7 +421,7 @@
 
       // only proceed if the response has not been marked complete and
       // navigation to another view has not occurred
-      if (event instanceof ActionEvent && !context.getResponseComplete() && context.getViewRoot() == getViewRootOf(event))
+      if ((event instanceof ActionEvent) && !context.getResponseComplete() && (context.getViewRoot() == getViewRootOf(event)))
       {
          ActionListener listener = context.getApplication().getActionListener();
          if (listener != null)
@@ -498,7 +502,7 @@
     * passing the {@link ActionEvent} just created.
     */
    @Override
-   public void decode(FacesContext context)
+   public void decode(final FacesContext context)
    {
       if (context == null)
       {
@@ -528,7 +532,7 @@
       queueEvent(e);
    }
 
-   private UIViewRoot getViewRootOf(FacesEvent e)
+   private UIViewRoot getViewRootOf(final FacesEvent e)
    {
       UIComponent c = e.getComponent();
       do
@@ -543,7 +547,7 @@
       return null;
    }
 
-   private Lifecycle getLifecycle(FacesContext context)
+   private Lifecycle getLifecycle(final FacesContext context)
    {
       LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
       String lifecycleId = context.getExternalContext().getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR);
@@ -562,12 +566,12 @@
    private class InstrumentedFacesContext extends FacesContextWrapper
    {
 
-      private FacesContext wrapped;
+      private final FacesContext wrapped;
       private boolean viewRootCleared = false;
       private boolean renderedResponseControlDisabled = false;
       private Boolean postback = null;
 
-      public InstrumentedFacesContext(FacesContext wrapped)
+      public InstrumentedFacesContext(final FacesContext wrapped)
       {
          this.wrapped = wrapped;
       }
@@ -590,7 +594,7 @@
       }
 
       @Override
-      public void setViewRoot(UIViewRoot viewRoot)
+      public void setViewRoot(final UIViewRoot viewRoot)
       {
          viewRootCleared = false;
          wrapped.setViewRoot(viewRoot);

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,77 @@
+package org.jboss.seam.faces.event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.jboss.seam.faces.cdi.BeanManagerAware;
+
+/**
+ * Provide CDI injection to PhaseListener artifacts by delegating through this
+ * class.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+public class DelegatingPhaseListener extends BeanManagerAware implements PhaseListener
+{
+   private static final long serialVersionUID = 8454616175394888259L;
+
+   public PhaseId getPhaseId()
+   {
+      return PhaseId.ANY_PHASE;
+   }
+
+   public void beforePhase(final PhaseEvent event)
+   {
+      for (PhaseListener listener : getPhaseListeners())
+      {
+         if (shouldProcessPhase(listener, event))
+         {
+            listener.beforePhase(event);
+         }
+      }
+   }
+
+   public void afterPhase(final PhaseEvent event)
+   {
+      for (PhaseListener listener : getPhaseListeners())
+      {
+         if (shouldProcessPhase(listener, event))
+         {
+            listener.afterPhase(event);
+         }
+      }
+   }
+
+   /**
+    * Determine if the {@link PhaseListener} should process the given
+    * {@link PhaseEvent}.
+    */
+   private boolean shouldProcessPhase(final PhaseListener listener, final PhaseEvent event)
+   {
+      return (PhaseId.ANY_PHASE.equals(listener.getPhaseId()) || event.getPhaseId().equals(listener.getPhaseId()));
+   }
+
+   @SuppressWarnings("unchecked")
+   private List<PhaseListener> getPhaseListeners()
+   {
+      BeanManager manager = getBeanManager();
+      List<PhaseListener> result = new ArrayList<PhaseListener>();
+
+      Bean<PhaseEventBridge> bean = (Bean<PhaseEventBridge>) manager.getBeans(PhaseEventBridge.class).iterator().next();
+      CreationalContext<PhaseEventBridge> context = manager.createCreationalContext(bean);
+      PhaseEventBridge listener = (PhaseEventBridge) manager.getReference(bean, PhaseEventBridge.class, context);
+
+      result.add(listener);
+
+      return result;
+   }
+
+}

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,56 @@
+package org.jboss.seam.faces.event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+import org.jboss.seam.faces.cdi.BeanManagerAware;
+
+/**
+ * Provide CDI injection to SystemEventListener artifacts by delegating through
+ * this class.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+public class DelegatingSystemEventListener extends BeanManagerAware implements SystemEventListener
+{
+
+   public boolean isListenerForSource(final Object source)
+   {
+      return true;
+   }
+
+   public void processEvent(final SystemEvent event) throws AbortProcessingException
+   {
+      for (SystemEventListener l : getEventListeners())
+      {
+         if (l.isListenerForSource(event.getSource()))
+         {
+            l.processEvent(event);
+         }
+      }
+   }
+
+   @SuppressWarnings("unchecked")
+   private List<SystemEventListener> getEventListeners()
+   {
+      BeanManager manager = getBeanManager();
+      List<SystemEventListener> result = new ArrayList<SystemEventListener>();
+
+      Bean<SystemEventBridge> bean = (Bean<SystemEventBridge>) manager.getBeans(SystemEventBridge.class).iterator().next();
+      CreationalContext<SystemEventBridge> context = manager.createCreationalContext(bean);
+      SystemEventBridge listener = (SystemEventBridge) manager.getReference(bean, SystemEventBridge.class, context);
+
+      result.add(listener);
+
+      return result;
+   }
+
+}

Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -1,51 +0,0 @@
-package org.jboss.seam.faces.event;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
- at SuppressWarnings("serial")
-public class GenericEventListener
-{
-
-   @Inject
-   BeanManager beanManager;
-
-   // FIXME: hack to work around invalid binding in JBoss AS 6 M2
-   private static final List<String> beanManagerLocations = new ArrayList<String>()
-   {
-      {
-         add("java:comp/BeanManager");
-         add("java:app/BeanManager");
-      }
-   };
-
-   protected BeanManager getBeanManager()
-   {
-      if (beanManager == null)
-      {
-         beanManager = lookupBeanManager();
-      }
-      return beanManager;
-   }
-
-   private BeanManager lookupBeanManager()
-   {
-      for (String location : beanManagerLocations)
-      {
-         try
-         {
-            return (BeanManager) new InitialContext().lookup(location);
-         }
-         catch (NamingException e)
-         {
-            // No panic, keep trying
-         }
-      }
-      throw new IllegalArgumentException("Could not find BeanManager in " + beanManagerLocations);
-   }
-}

Copied: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java (from rev 12236, modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventListener.java)
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,163 @@
+package org.jboss.seam.faces.event;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.inject.Inject;
+
+import org.jboss.seam.faces.cdi.BeanManagerAware;
+import org.jboss.seam.faces.event.qualifier.After;
+import org.jboss.seam.faces.event.qualifier.AnyPhase;
+import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.event.qualifier.InvokeApplication;
+import org.jboss.seam.faces.event.qualifier.ProcessValidations;
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+import org.jboss.seam.faces.event.qualifier.RestoreView;
+import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
+import org.slf4j.Logger;
+
+/**
+ * A PhaseListener used to bridge JSF phase events to the CDI event model.
+ * <p>
+ * 
+ * For each JSF {@link PhaseEvent}, a corresponding Seam CDI event will be
+ * fired. Event listeners can be registered by observing the appropriate Seam
+ * CDI event (see @{@link Observes}):
+ * <p>
+ * <b>For example:</b>
+ * <p>
+ * <code>
+ * public void listener(@Observes @Before @RenderResponse PhaseEvent event)
+ * {
+ *    //do something
+ * }
+ * </code>
+ * 
+ * @author Nicklas Karlsson
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+ at ApplicationScoped
+public class PhaseEventBridge extends BeanManagerAware implements PhaseListener
+{
+   private static final long serialVersionUID = -6181019551463318453L;
+
+   @Inject
+   private Logger log;
+
+   /**
+    * @param whenQualifier When this event occurred (e.g.:
+    *           {@link PhaseListener#beforePhase(PhaseEvent)} or
+    *           {@link PhaseListener#afterPhase(PhaseEvent)})
+    * @param event The JSF PhaseEvent to be propagated
+    */
+   private void handlePhase(final AnnotationLiteral<?> whenQualifier, final PhaseEvent event)
+   {
+      Annotation phaseQualifier = null;
+
+      if (PhaseId.RESTORE_VIEW.equals(event.getPhaseId()))
+      {
+         phaseQualifier = PhaseEventBridge.RESTORE_VIEW;
+      }
+      else if (PhaseId.PROCESS_VALIDATIONS.equals(event.getPhaseId()))
+      {
+         phaseQualifier = PhaseEventBridge.PROCESS_VALIDATIONS;
+      }
+      else if (PhaseId.APPLY_REQUEST_VALUES.equals(event.getPhaseId()))
+      {
+         phaseQualifier = PhaseEventBridge.APPLY_REQUEST_VALUES;
+      }
+      else if (PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId()))
+      {
+         phaseQualifier = PhaseEventBridge.INVOKE_APPLICATION;
+      }
+      else if (PhaseId.UPDATE_MODEL_VALUES.equals(event.getPhaseId()))
+      {
+         phaseQualifier = PhaseEventBridge.UPDATE_MODEL_VALUES;
+      }
+      else if (PhaseId.RENDER_RESPONSE.equals(event.getPhaseId()))
+      {
+         phaseQualifier = PhaseEventBridge.RENDER_RESPONSE;
+      }
+      else
+      {
+         log.error("Unknown JSF PhaseId detected during CDI event broadcasting");
+      }
+
+      /*
+       * This propagates the event to CDI
+       */
+      getBeanManager().fireEvent(event, new Annotation[] { whenQualifier, phaseQualifier });
+      getBeanManager().fireEvent(event, new Annotation[] { whenQualifier, PhaseEventBridge.ANY_PHASE });
+   }
+
+   public void afterPhase(final PhaseEvent e)
+   {
+      handlePhase(AFTER, e);
+   }
+
+   public void beforePhase(final PhaseEvent e)
+   {
+      handlePhase(BEFORE, e);
+   }
+
+   public PhaseId getPhaseId()
+   {
+      return PhaseId.ANY_PHASE;
+   }
+
+   /*
+    * Annotation Literal Constants
+    */
+   private static final AnnotationLiteral<Before> BEFORE = new AnnotationLiteral<Before>()
+   {
+      private static final long serialVersionUID = -1610281796509557441L;
+   };
+
+   private static final AnnotationLiteral<After> AFTER = new AnnotationLiteral<After>()
+   {
+      private static final long serialVersionUID = 5121252401235504952L;
+   };
+
+   private static final AnnotationLiteral<AnyPhase> ANY_PHASE = new AnnotationLiteral<AnyPhase>()
+   {
+      private static final long serialVersionUID = 6334015723435615561L;
+   };
+
+   private static final AnnotationLiteral<RestoreView> RESTORE_VIEW = new AnnotationLiteral<RestoreView>()
+   {
+      private static final long serialVersionUID = 8812020629644833820L;
+   };
+
+   private static final AnnotationLiteral<ProcessValidations> PROCESS_VALIDATIONS = new AnnotationLiteral<ProcessValidations>()
+   {
+      private static final long serialVersionUID = 8637149472340997800L;
+   };
+
+   private static final AnnotationLiteral<ApplyRequestValues> APPLY_REQUEST_VALUES = new AnnotationLiteral<ApplyRequestValues>()
+   {
+      private static final long serialVersionUID = 8558744089046159077L;
+   };
+
+   private static final AnnotationLiteral<InvokeApplication> INVOKE_APPLICATION = new AnnotationLiteral<InvokeApplication>()
+   {
+      private static final long serialVersionUID = 3161037426109802030L;
+   };
+
+   private static final AnnotationLiteral<UpdateModelValues> UPDATE_MODEL_VALUES = new AnnotationLiteral<UpdateModelValues>()
+   {
+      private static final long serialVersionUID = -2714189905299700793L;
+   };
+
+   private static final AnnotationLiteral<RenderResponse> RENDER_RESPONSE = new AnnotationLiteral<RenderResponse>()
+   {
+      private static final long serialVersionUID = -8708300190197778734L;
+   };
+
+}

Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventListener.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventListener.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -1,100 +0,0 @@
-package org.jboss.seam.faces.event;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.util.AnnotationLiteral;
-import javax.faces.event.PhaseEvent;
-import javax.faces.event.PhaseId;
-import javax.faces.event.PhaseListener;
-
-import org.jboss.seam.faces.event.qualifier.After;
-import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
-import org.jboss.seam.faces.event.qualifier.Before;
-import org.jboss.seam.faces.event.qualifier.InvokeApplication;
-import org.jboss.seam.faces.event.qualifier.ProcessValidations;
-import org.jboss.seam.faces.event.qualifier.RenderResponse;
-import org.jboss.seam.faces.event.qualifier.RestoreView;
-import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
-
-public class PhaseEventListener extends GenericEventListener implements PhaseListener
-{
-   private static final long serialVersionUID = 1L;
-
-   private enum When
-   {
-      BEFORE, AFTER
-   };
-
-   @SuppressWarnings("serial")
-   private void handlePhase(When when, PhaseEvent e)
-   {
-      Annotation whenAnnotation = null;
-      Annotation phaseAnnotation = null;
-      switch (when)
-      {
-      case BEFORE:
-         whenAnnotation = new AnnotationLiteral<Before>()
-         {
-         };
-         break;
-      case AFTER:
-         whenAnnotation = new AnnotationLiteral<After>()
-         {
-         };
-         break;
-      }
-      if (e.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES)
-      {
-         phaseAnnotation = new AnnotationLiteral<ApplyRequestValues>()
-         {
-         };
-      }
-      else if (e.getPhaseId() == PhaseId.INVOKE_APPLICATION)
-      {
-         phaseAnnotation = new AnnotationLiteral<InvokeApplication>()
-         {
-         };
-      }
-      else if (e.getPhaseId() == PhaseId.PROCESS_VALIDATIONS)
-      {
-         phaseAnnotation = new AnnotationLiteral<ProcessValidations>()
-         {
-         };
-      }
-      else if (e.getPhaseId() == PhaseId.RENDER_RESPONSE)
-      {
-         phaseAnnotation = new AnnotationLiteral<RenderResponse>()
-         {
-         };
-      }
-      else if (e.getPhaseId() == PhaseId.RESTORE_VIEW)
-      {
-         phaseAnnotation = new AnnotationLiteral<RestoreView>()
-         {
-         };
-      }
-      else if (e.getPhaseId() == PhaseId.UPDATE_MODEL_VALUES)
-      {
-         phaseAnnotation = new AnnotationLiteral<UpdateModelValues>()
-         {
-         };
-      }
-      getBeanManager().fireEvent(e, new Annotation[] { whenAnnotation, phaseAnnotation });
-   }
-
-   public void afterPhase(PhaseEvent e)
-   {
-      handlePhase(When.AFTER, e);
-   }
-
-   public void beforePhase(PhaseEvent e)
-   {
-      handlePhase(When.BEFORE, e);
-   }
-
-   public PhaseId getPhaseId()
-   {
-      return PhaseId.ANY_PHASE;
-   }
-
-}

Copied: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java (from rev 12236, modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventListener.java)
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,120 @@
+package org.jboss.seam.faces.event;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ComponentSystemEvent;
+import javax.faces.event.ExceptionQueuedEvent;
+import javax.faces.event.PostConstructApplicationEvent;
+import javax.faces.event.PostConstructCustomScopeEvent;
+import javax.faces.event.PreDestroyApplicationEvent;
+import javax.faces.event.PreDestroyCustomScopeEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+import org.jboss.seam.faces.SeamFacesException;
+import org.jboss.seam.faces.cdi.BeanManagerAware;
+
+/**
+ * A SystemEventListener used to bridge JSF system events to the CDI event
+ * model.
+ * <p>
+ * 
+ * For each JSF system event (e.g: {@link PostConstructApplicationEvent}, a
+ * corresponding Seam CDI event will be fired.
+ * <p>
+ * 
+ * Event listeners can be registered by observing the appropriate Seam CDI event
+ * (see @{@link Observes}):
+ * <p>
+ * <b>For example:</b>
+ * <p>
+ * <code>
+ * public void listener(@Observes org.jboss.seam.faces.event.qualifier.ExceptionQueuedEvent event)
+ * {
+ *    //do something
+ * }
+ * </code>
+ * 
+ */
+ at ApplicationScoped
+public class SystemEventBridge extends BeanManagerAware implements SystemEventListener
+{
+
+   public boolean isListenerForSource(final Object source)
+   {
+      return true;
+   }
+
+   public void processEvent(final SystemEvent e) throws AbortProcessingException
+   {
+      Object payload = e.getClass().cast(e);
+      Annotation qualifier = null;
+
+      if (e instanceof ComponentSystemEvent)
+      {
+         qualifier = COMPONENT_SYSTEM_EVENT;
+      }
+      else if (e instanceof ExceptionQueuedEvent)
+      {
+         qualifier = EXCEPTION_QUEUED_EVENT;
+      }
+      else if (e instanceof PostConstructApplicationEvent)
+      {
+         qualifier = POST_CONSTRUCT_APPLICATION_EVENT;
+      }
+      else if (e instanceof PostConstructCustomScopeEvent)
+      {
+         qualifier = POST_CONSTRUCT_CUSTOM_SCOPE_EVENT;
+      }
+      else if (e instanceof PreDestroyApplicationEvent)
+      {
+         qualifier = PRE_DESTROY_APPLICATION_EVENT;
+      }
+      else if (e instanceof PreDestroyCustomScopeEvent)
+      {
+         qualifier = PRE_DESTROY_CUSTOM_SCOPE_EVENT;
+      }
+      else
+      {
+         throw new SeamFacesException("Unknown JSF System Event detected during CDI event broadcasting");
+      }
+
+      /*
+       * This propagates the event to CDI
+       */
+      getBeanManager().fireEvent(payload, qualifier);
+   }
+
+   /*
+    * System Event Annotations
+    */
+   private static final AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PreDestroyCustomScopeEvent> PRE_DESTROY_CUSTOM_SCOPE_EVENT = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PreDestroyCustomScopeEvent>()
+   {
+      private static final long serialVersionUID = -7243409955575081242L;
+   };
+   private static final AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PreDestroyApplicationEvent> PRE_DESTROY_APPLICATION_EVENT = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PreDestroyApplicationEvent>()
+   {
+      private static final long serialVersionUID = -7448942843812054204L;
+   };
+   private static final AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PostConstructCustomScopeEvent> POST_CONSTRUCT_CUSTOM_SCOPE_EVENT = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PostConstructCustomScopeEvent>()
+   {
+      private static final long serialVersionUID = 6194794712139598271L;
+   };
+   private static final AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PostConstructApplicationEvent> POST_CONSTRUCT_APPLICATION_EVENT = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PostConstructApplicationEvent>()
+   {
+      private static final long serialVersionUID = -7119316486394672512L;
+   };
+   private static final AnnotationLiteral<org.jboss.seam.faces.event.qualifier.ExceptionQueuedEvent> EXCEPTION_QUEUED_EVENT = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.ExceptionQueuedEvent>()
+   {
+      private static final long serialVersionUID = -2694169811275854595L;
+   };
+   private static final AnnotationLiteral<org.jboss.seam.faces.event.qualifier.ComponentSystemEvent> COMPONENT_SYSTEM_EVENT = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.ComponentSystemEvent>()
+   {
+      private static final long serialVersionUID = -8018221003951485295L;
+   };
+
+}

Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventListener.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventListener.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventListener.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -1,66 +0,0 @@
-package org.jboss.seam.faces.event;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.util.AnnotationLiteral;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.ComponentSystemEvent;
-import javax.faces.event.ExceptionQueuedEvent;
-import javax.faces.event.PostConstructApplicationEvent;
-import javax.faces.event.PostConstructCustomScopeEvent;
-import javax.faces.event.PreDestroyApplicationEvent;
-import javax.faces.event.PreDestroyCustomScopeEvent;
-import javax.faces.event.SystemEvent;
-
-public class SystemEventListener extends GenericEventListener implements javax.faces.event.SystemEventListener
-{
-   public boolean isListenerForSource(Object source)
-   {
-      return true;
-   }
-
-   @SuppressWarnings("serial")
-   public void processEvent(SystemEvent e) throws AbortProcessingException
-   {
-      Object payload = e.getClass().cast(e);
-      Annotation qualifier = null;
-      if (e instanceof ComponentSystemEvent)
-      {
-         qualifier = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.ComponentSystemEvent>()
-         {
-         };
-      }
-      else if (e instanceof ExceptionQueuedEvent)
-      {
-         qualifier = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.ExceptionQueuedEvent>()
-         {
-         };
-      }
-      else if (e instanceof PostConstructApplicationEvent)
-      {
-         qualifier = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PostConstructApplicationEvent>()
-         {
-         };
-      }
-      else if (e instanceof PostConstructCustomScopeEvent)
-      {
-         qualifier = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PostConstructCustomScopeEvent>()
-         {
-         };
-      }
-      else if (e instanceof PreDestroyApplicationEvent)
-      {
-         qualifier = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PreDestroyApplicationEvent>()
-         {
-         };
-      }
-      else if (e instanceof PreDestroyCustomScopeEvent)
-      {
-         qualifier = new AnnotationLiteral<org.jboss.seam.faces.event.qualifier.PreDestroyCustomScopeEvent>()
-         {
-         };
-      }
-      getBeanManager().fireEvent(payload, qualifier);
-   }
-
-}

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/AnyPhase.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/AnyPhase.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/AnyPhase.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,20 @@
+package org.jboss.seam.faces.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;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ */
+ at Qualifier
+ at Target( { FIELD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface AnyPhase
+{
+}
\ No newline at end of file

Modified: modules/faces/trunk/src/main/resources/META-INF/faces-config.xml
===================================================================
--- modules/faces/trunk/src/main/resources/META-INF/faces-config.xml	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/main/resources/META-INF/faces-config.xml	2010-03-23 01:52:45 UTC (rev 12245)
@@ -15,67 +15,36 @@
 
 	<lifecycle>
 		<phase-listener>org.jboss.seam.faces.context.FlashScopedContext</phase-listener>
-		<phase-listener>org.jboss.seam.faces.event.PhaseEventListener</phase-listener>      
-	</lifecycle>
+		<phase-listener>org.jboss.seam.faces.event.DelegatingPhaseListener</phase-listener>      
+	</lifecycle> 
 
 	<application>
 		<system-event-listener>
-			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
 			<system-event-class>javax.faces.event.ComponentSystemEvent</system-event-class>
 		</system-event-listener>
 		<system-event-listener>
-			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
 			<system-event-class>javax.faces.event.ExceptionQueuedEvent</system-event-class>
 		</system-event-listener>
 		<system-event-listener>
-			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
 			<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
 		</system-event-listener>
 		<system-event-listener>
-			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
 			<system-event-class>javax.faces.event.PostConstructCustomScopeEvent</system-event-class>
 		</system-event-listener>
 		<system-event-listener>
-			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
 			<system-event-class>javax.faces.event.PreDestroyApplicationEvent</system-event-class>
 		</system-event-listener>
 		<system-event-listener>
-			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
 			<system-event-class>javax.faces.event.PreDestroyCustomScopeEvent</system-event-class>
 		</system-event-listener>
 	</application>	
 
-	<!--
-   <factory>
-      <application-factory>org.jboss.seam.faces.application.SeamApplicationFactory</application-factory>
-   </factory>
-
-   <application>
-      <message-bundle>org.jboss.seam.international.SeamResourceBundleAdapter</message-bundle>
-      <view-handler>org.jboss.seam.faces.application.SeamViewHandler</view-handler>
-      <el-resolver>org.jboss.seam.el.SeamELResolver</el-resolver>
-      <el-resolver>org.jboss.seam.faces.el.SeamFacesELResolver</el-resolver>
-      <system-event-listener>
-         <system-event-listener-class>org.jboss.seam.faces.lifecycle.SeamPreRenderViewListener</system-event-listener-class>
-         <system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
-      </system-event-listener>
-   </application>
-
-   <lifecycle>
-      <phase-listener>org.jboss.seam.faces.lifecycle.SeamPhaseListener</phase-listener>
-   </lifecycle>
-
-   <component>
-      <component-type>org.jboss.seam.faces.Import</component-type>
-      <component-class>org.jboss.seam.faces.component.UIImport</component-class>
-   </component>
-   
-   <component>
-      <component-type>org.jboss.seam.faces.RestrictView</component-type>
-      <component-class>org.jboss.seam.faces.component.UIRestrictView</component-class>
-   </component>
-   -->
-
 	<component>
 		<component-type>org.jboss.seam.faces.ViewAction</component-type>
 		<component-class>org.jboss.seam.faces.component.UIViewAction</component-class>

Added: modules/faces/trunk/src/test/java/org/jboss/seam/faces/MockLogger.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/MockLogger.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/MockLogger.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,271 @@
+package org.jboss.seam.faces;
+
+import org.slf4j.Logger;
+import org.slf4j.Marker;
+
+/**
+ * Provide a completely empty logger implementation for Unit Tests. This entire
+ * class is a no-op; it does <i>nothing</i>.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+public class MockLogger implements Logger
+{
+
+   public void debug(final String arg0)
+   {
+   }
+
+   public void debug(final String arg0, final Object arg1)
+   {
+   }
+
+   public void debug(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void debug(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void debug(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void debug(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public void error(final String arg0)
+   {
+   }
+
+   public void error(final String arg0, final Object arg1)
+   {
+   }
+
+   public void error(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void error(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void error(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void error(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public String getName()
+   {
+      return null;
+   }
+
+   public void info(final String arg0)
+   {
+   }
+
+   public void info(final String arg0, final Object arg1)
+   {
+   }
+
+   public void info(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void info(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void info(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void info(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public boolean isDebugEnabled()
+   {
+      return false;
+   }
+
+   public boolean isDebugEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isErrorEnabled()
+   {
+      return false;
+   }
+
+   public boolean isErrorEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isInfoEnabled()
+   {
+      return false;
+   }
+
+   public boolean isInfoEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isTraceEnabled()
+   {
+      return false;
+   }
+
+   public boolean isTraceEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public boolean isWarnEnabled()
+   {
+      return false;
+   }
+
+   public boolean isWarnEnabled(final Marker arg0)
+   {
+      return false;
+   }
+
+   public void trace(final String arg0)
+   {
+   }
+
+   public void trace(final String arg0, final Object arg1)
+   {
+   }
+
+   public void trace(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void trace(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void trace(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void trace(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+   public void warn(final String arg0)
+   {
+   }
+
+   public void warn(final String arg0, final Object arg1)
+   {
+   }
+
+   public void warn(final String arg0, final Object[] arg1)
+   {
+   }
+
+   public void warn(final String arg0, final Throwable arg1)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1)
+   {
+   }
+
+   public void warn(final String arg0, final Object arg1, final Object arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Object arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Object[] arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Throwable arg2)
+   {
+   }
+
+   public void warn(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+   {
+   }
+
+}

Copied: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java (from rev 12236, modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java)
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,139 @@
+package org.jboss.seam.faces.event;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.faces.MockLogger;
+import org.jboss.seam.faces.cdi.BeanManagerAware;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.jboss.test.faces.mock.context.MockFacesContext;
+import org.jboss.test.faces.mock.lifecycle.MockLifecycle;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class PhaseEventBridgeTest
+{
+   @Deployment
+   public static JavaArchive createTestArchive()
+   {
+      return Archives.create("test.jar", JavaArchive.class).addClasses(PhaseEventObserver.class, PhaseEventBridge.class, BeanManagerAware.class, MockLogger.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+   }
+
+   @Inject
+   PhaseEventBridge phaseEventBridge;
+
+   private final MockFacesContext facesContext = new MockFacesContext();
+   private final MockLifecycle lifecycle = new MockLifecycle();
+
+   @Test
+   public void testBeforeAnyPhaseObserver()
+   {
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, lifecycle));
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, lifecycle));
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, lifecycle));
+      assertEquals(3, PhaseEventObserver.beforeAnyPhaseCount);
+   }
+
+   @Test
+   public void testAfterAnyPhaseObserver()
+   {
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, lifecycle));
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, lifecycle));
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, lifecycle));
+      assertEquals(3, PhaseEventObserver.afterAnyPhaseCount);
+   }
+
+   @Test
+   public void testBeforeRenderResponseObserver()
+   {
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, lifecycle));
+      assert PhaseEventObserver.observeBeforeRenderResponse;
+   }
+
+   @Test
+   public void testAfterRenderResponseObserver()
+   {
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, lifecycle));
+      assert PhaseEventObserver.observeAfterRenderResponse;
+   }
+
+   @Test
+   public void testBeforeApplyRequestValuesObserver()
+   {
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, lifecycle));
+      assert PhaseEventObserver.observeBeforeApplyRequestValues;
+   }
+
+   @Test
+   public void testAfterApplyRequestValuesObserver()
+   {
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, lifecycle));
+      assert PhaseEventObserver.observeAfterApplyRequestValues;
+   }
+
+   @Test
+   public void testBeforeInvokeApplicationObserver()
+   {
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, lifecycle));
+      assert PhaseEventObserver.observeBeforeInvokeApplication;
+   }
+
+   @Test
+   public void testAfterInvokeApplicationObserver()
+   {
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, lifecycle));
+      assert PhaseEventObserver.observeAfterInvokeApplication;
+   }
+
+   @Test
+   public void testBeforeProcessValidationsObserver()
+   {
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, lifecycle));
+      assert PhaseEventObserver.observeBeforeProcessValidations;
+   }
+
+   @Test
+   public void testAfterProcessValidationsObserver()
+   {
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, lifecycle));
+      assert PhaseEventObserver.observeAfterProcessValidations;
+   }
+
+   @Test
+   public void testBeforeRestoreViewObserver()
+   {
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, lifecycle));
+      assert PhaseEventObserver.observeBeforeRestoreView;
+   }
+
+   @Test
+   public void testAfterRestoreViewObserver()
+   {
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, lifecycle));
+      assert PhaseEventObserver.observeAfterRestoreView;
+   }
+
+   @Test
+   public void testBeforeUpdateModelValuesObserver()
+   {
+      phaseEventBridge.beforePhase(new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, lifecycle));
+      assert PhaseEventObserver.observeBeforeUpdateModelValues;
+   }
+
+   @Test
+   public void testAfterUpdateModelValuesObserver()
+   {
+      phaseEventBridge.afterPhase(new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, lifecycle));
+      assert PhaseEventObserver.observeAfterUpdateModelValues;
+   }
+
+}

Copied: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java (from rev 12236, modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java)
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,105 @@
+package org.jboss.seam.faces.event;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.faces.event.PhaseEvent;
+
+import org.jboss.seam.faces.event.qualifier.After;
+import org.jboss.seam.faces.event.qualifier.AnyPhase;
+import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.event.qualifier.InvokeApplication;
+import org.jboss.seam.faces.event.qualifier.ProcessValidations;
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+import org.jboss.seam.faces.event.qualifier.RestoreView;
+import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
+
+ at ApplicationScoped
+public class PhaseEventObserver
+{
+   public static boolean observeBeforeRenderResponse;
+   public static boolean observeAfterRenderResponse;
+   public static boolean observeBeforeApplyRequestValues;
+   public static boolean observeAfterApplyRequestValues;
+   public static boolean observeBeforeInvokeApplication;
+   public static boolean observeAfterInvokeApplication;
+   public static boolean observeBeforeProcessValidations;
+   public static boolean observeAfterProcessValidations;
+   public static boolean observeBeforeRestoreView;
+   public static boolean observeAfterRestoreView;
+   public static boolean observeBeforeUpdateModelValues;
+   public static boolean observeAfterUpdateModelValues;
+   public static int beforeAnyPhaseCount;
+   public static int afterAnyPhaseCount;
+
+   public void observeBeforeAnyPhase(@Observes @Before @AnyPhase final PhaseEvent e)
+   {
+      beforeAnyPhaseCount++;
+   }
+
+   public void observeAfterAnyPhase(@Observes @After @AnyPhase final PhaseEvent e)
+   {
+      afterAnyPhaseCount++;
+   }
+
+   public void observeBeforeRenderResponse(@Observes @Before @RenderResponse final PhaseEvent e)
+   {
+      PhaseEventObserver.observeBeforeRenderResponse = true;
+   }
+
+   public void observeAfterRenderResponse(@Observes @After @RenderResponse final PhaseEvent e)
+   {
+      PhaseEventObserver.observeAfterRenderResponse = true;
+   }
+
+   public void observeBeforeApplyRequestValues(@Observes @Before @ApplyRequestValues final PhaseEvent e)
+   {
+      PhaseEventObserver.observeBeforeApplyRequestValues = true;
+   }
+
+   public void observeAfterApplyRequestValues(@Observes @After @ApplyRequestValues final PhaseEvent e)
+   {
+      PhaseEventObserver.observeAfterApplyRequestValues = true;
+   }
+
+   public void observeBeforeInvokeApplication(@Observes @Before @InvokeApplication final PhaseEvent e)
+   {
+      PhaseEventObserver.observeBeforeInvokeApplication = true;
+   }
+
+   public void observeAfterInvokeApplication(@Observes @After @InvokeApplication final PhaseEvent e)
+   {
+      PhaseEventObserver.observeAfterInvokeApplication = true;
+   }
+
+   public void observeBeforeProcessValidations(@Observes @Before @ProcessValidations final PhaseEvent e)
+   {
+      PhaseEventObserver.observeBeforeProcessValidations = true;
+   }
+
+   public void observeAfterProcessValidations(@Observes @After @ProcessValidations final PhaseEvent e)
+   {
+      PhaseEventObserver.observeAfterProcessValidations = true;
+   }
+
+   public void observeBeforeRestoreView(@Observes @Before @RestoreView final PhaseEvent e)
+   {
+      PhaseEventObserver.observeBeforeRestoreView = true;
+   }
+
+   public void observeAfterRestoreView(@Observes @After @RestoreView final PhaseEvent e)
+   {
+      PhaseEventObserver.observeAfterRestoreView = true;
+   }
+
+   public void observeBeforeUpdateModelValues(@Observes @Before @UpdateModelValues final PhaseEvent e)
+   {
+      PhaseEventObserver.observeBeforeUpdateModelValues = true;
+   }
+
+   public void observeAfterUpdateModelValues(@Observes @After @UpdateModelValues final PhaseEvent e)
+   {
+      PhaseEventObserver.observeAfterUpdateModelValues = true;
+   }
+
+}

Deleted: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -1,92 +0,0 @@
-package org.jboss.seam.faces.event;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-import javax.faces.event.PhaseEvent;
-
-import org.jboss.seam.faces.event.qualifier.After;
-import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
-import org.jboss.seam.faces.event.qualifier.Before;
-import org.jboss.seam.faces.event.qualifier.InvokeApplication;
-import org.jboss.seam.faces.event.qualifier.ProcessValidations;
-import org.jboss.seam.faces.event.qualifier.RenderResponse;
-import org.jboss.seam.faces.event.qualifier.RestoreView;
-import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
-
- at ApplicationScoped
-public class PhaseListenerObserver
-{
-   public static boolean observeBeforeRenderResponse;
-   public static boolean observeAfterRenderResponse;
-   public static boolean observeBeforeApplyRequestValues;
-   public static boolean observeAfterApplyRequestValues;
-   public static boolean observeBeforeInvokeApplication;
-   public static boolean observeAfterInvokeApplication;
-   public static boolean observeBeforeProcessValidations;
-   public static boolean observeAfterProcessValidations;
-   public static boolean observeBeforeRestoreView;
-   public static boolean observeAfterRestoreView;
-   public static boolean observeBeforeUpdateModelValues;
-   public static boolean observeAfterUpdateModelValues;
-   
-   public void observeBeforeRenderResponse(@Observes @Before @RenderResponse PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeBeforeRenderResponse = true;
-   }
-   
-   public void observeAfterRenderResponse(@Observes @After @RenderResponse PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeAfterRenderResponse = true;
-   }
-   
-   public void observeBeforeApplyRequestValues(@Observes @Before @ApplyRequestValues PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeBeforeApplyRequestValues = true;
-   }
-   
-   public void observeAfterApplyRequestValues(@Observes @After @ApplyRequestValues PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeAfterApplyRequestValues = true;
-   }
-   
-   public void observeBeforeInvokeApplication(@Observes @Before @InvokeApplication PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeBeforeInvokeApplication = true;
-   }
-   
-   public void observeAfterInvokeApplication(@Observes @After @InvokeApplication PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeAfterInvokeApplication = true;
-   }   
-   
-   public void observeBeforeProcessValidations(@Observes @Before @ProcessValidations PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeBeforeProcessValidations = true;
-   }
-   
-   public void observeAfterProcessValidations(@Observes @After @ProcessValidations PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeAfterProcessValidations = true;
-   }   
-   
-   public void observeBeforeRestoreView(@Observes @Before @RestoreView PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeBeforeRestoreView = true;
-   }
-   
-   public void observeAfterRestoreView(@Observes @After @RestoreView PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeAfterRestoreView = true;
-   }  
-
-   public void observeBeforeUpdateModelValues(@Observes @Before @UpdateModelValues PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeBeforeUpdateModelValues = true;
-   }
-   
-   public void observeAfterUpdateModelValues(@Observes @After @UpdateModelValues PhaseEvent e) 
-   {
-      PhaseListenerObserver.observeAfterUpdateModelValues = true;
-   }  
-   
-}

Deleted: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -1,117 +0,0 @@
-package org.jboss.seam.faces.event;
-
-import javax.faces.event.PhaseEvent;
-import javax.faces.event.PhaseId;
-import javax.inject.Inject;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
-import org.jboss.test.faces.mock.context.MockFacesContext;
-import org.jboss.test.faces.mock.lifecycle.MockLifecycle;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class PhaseListenerTests
-{
-   @Deployment
-   public static JavaArchive createTestArchive()
-   {
-      return Archives.create("test.jar", JavaArchive.class).addClasses(PhaseListenerObserver.class, PhaseEventListener.class, GenericEventListener.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
-   }
-
-   @Inject
-   PhaseEventListener phaseEventListener;
-
-   private final MockFacesContext facesContext = new MockFacesContext();
-   private final MockLifecycle lifecycle = new MockLifecycle();
-
-   @Test
-   public void testBeforeRenderResponseObserver()
-   {
-      phaseEventListener.beforePhase(new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, lifecycle));
-      assert PhaseListenerObserver.observeBeforeRenderResponse;
-   }
-
-   @Test
-   public void testAfterRenderResponseObserver()
-   {
-      phaseEventListener.afterPhase(new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, lifecycle));
-      assert PhaseListenerObserver.observeAfterRenderResponse;
-   }
-
-   @Test
-   public void testBeforeApplyRequestValuesObserver()
-   {
-      phaseEventListener.beforePhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, lifecycle));
-      assert PhaseListenerObserver.observeBeforeApplyRequestValues;
-   }
-
-   @Test
-   public void testAfterApplyRequestValuesObserver()
-   {
-      phaseEventListener.afterPhase(new PhaseEvent(facesContext, PhaseId.APPLY_REQUEST_VALUES, lifecycle));
-      assert PhaseListenerObserver.observeAfterApplyRequestValues;
-   }
-
-   @Test
-   public void testBeforeInvokeApplicationObserver()
-   {
-      phaseEventListener.beforePhase(new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, lifecycle));
-      assert PhaseListenerObserver.observeBeforeInvokeApplication;
-   }
-
-   @Test
-   public void testAfterInvokeApplicationObserver()
-   {
-      phaseEventListener.afterPhase(new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, lifecycle));
-      assert PhaseListenerObserver.observeAfterInvokeApplication;
-   }
-
-   @Test
-   public void testBeforeProcessValidationsObserver()
-   {
-      phaseEventListener.beforePhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, lifecycle));
-      assert PhaseListenerObserver.observeBeforeProcessValidations;
-   }
-
-   @Test
-   public void testAfterProcessValidationsObserver()
-   {
-      phaseEventListener.afterPhase(new PhaseEvent(facesContext, PhaseId.PROCESS_VALIDATIONS, lifecycle));
-      assert PhaseListenerObserver.observeAfterProcessValidations;
-   }
-
-   @Test
-   public void testBeforeRestoreViewObserver()
-   {
-      phaseEventListener.beforePhase(new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, lifecycle));
-      assert PhaseListenerObserver.observeBeforeRestoreView;
-   }
-
-   @Test
-   public void testAfterRestoreViewObserver()
-   {
-      phaseEventListener.afterPhase(new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, lifecycle));
-      assert PhaseListenerObserver.observeAfterRestoreView;
-   }
-
-   @Test
-   public void testBeforeUpdateModelValuesObserver()
-   {
-      phaseEventListener.beforePhase(new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, lifecycle));
-      assert PhaseListenerObserver.observeBeforeUpdateModelValues;
-   }
-
-   @Test
-   public void testAfterUpdateModelValuesObserver()
-   {
-      phaseEventListener.afterPhase(new PhaseEvent(facesContext, PhaseId.UPDATE_MODEL_VALUES, lifecycle));
-      assert PhaseListenerObserver.observeAfterUpdateModelValues;
-   }
-
-}

Copied: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java (from rev 12236, modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java)
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -0,0 +1,93 @@
+package org.jboss.seam.faces.event;
+
+import java.util.HashMap;
+
+import javax.faces.event.ComponentSystemEvent;
+import javax.faces.event.ExceptionQueuedEvent;
+import javax.faces.event.ExceptionQueuedEventContext;
+import javax.faces.event.PostConstructApplicationEvent;
+import javax.faces.event.PostConstructCustomScopeEvent;
+import javax.faces.event.PreDestroyApplicationEvent;
+import javax.faces.event.PreDestroyCustomScopeEvent;
+import javax.faces.event.ScopeContext;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.faces.cdi.BeanManagerAware;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.jboss.test.faces.mock.application.MockApplication;
+import org.jboss.test.faces.mock.component.MockUIComponent;
+import org.jboss.test.faces.mock.context.MockFacesContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class SystemEventBridgeTest
+{
+
+   @Deployment
+   public static JavaArchive createTestArchive()
+   {
+      return Archives.create("test.jar", JavaArchive.class).addClasses(SystemEventObserver.class, SystemEventBridge.class, BeanManagerAware.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+   }
+
+   @Inject
+   SystemEventBridge systemEventListener;
+
+   private final MockFacesContext facesContext = new MockFacesContext();
+   private final MockApplication application = new MockApplication();
+
+   @SuppressWarnings("serial")
+   @Test
+   public void testComponentSystemEventObserver()
+   {
+      systemEventListener.processEvent(new ComponentSystemEvent(new MockUIComponent())
+      {
+      });
+      assert SystemEventObserver.componentSystemEvent;
+   }
+
+   @Test
+   public void testExceptionQueuedEventObserver()
+   {
+      ExceptionQueuedEventContext eqec = new ExceptionQueuedEventContext(facesContext, new NullPointerException());
+      ExceptionQueuedEvent eqe = new ExceptionQueuedEvent(eqec);
+      systemEventListener.processEvent(eqe);
+      assert SystemEventObserver.excecptionQueuedEvent;
+   }
+
+   @Test
+   public void testPostConstructApplicationEventObserver()
+   {
+      systemEventListener.processEvent(new PostConstructApplicationEvent(application));
+      assert SystemEventObserver.postConstructApplicationEvent;
+   }
+
+   @Test
+   public void testPostConstructCustomScopeEvent()
+   {
+      ScopeContext sc = new ScopeContext("dummyscope", new HashMap<String, Object>());
+      systemEventListener.processEvent(new PostConstructCustomScopeEvent(sc));
+      assert SystemEventObserver.postConstructCustomScopeEvent;
+   }
+
+   @Test
+   public void testPreDestroyApplicationEventObserver()
+   {
+      systemEventListener.processEvent(new PreDestroyApplicationEvent(application));
+      assert SystemEventObserver.preDestroyApplicationEvent;
+   }
+
+   @Test
+   public void testPreDestroyCustomScopeEventObserver()
+   {
+      ScopeContext sc = new ScopeContext("dummyscope", new HashMap<String, Object>());
+      systemEventListener.processEvent(new PreDestroyCustomScopeEvent(sc));
+      assert SystemEventObserver.preDestroyCustomScopeEvent;
+   }
+
+}

Deleted: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java	2010-03-23 01:15:48 UTC (rev 12244)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java	2010-03-23 01:52:45 UTC (rev 12245)
@@ -1,92 +0,0 @@
-package org.jboss.seam.faces.event;
-
-import java.util.HashMap;
-
-import javax.faces.event.ComponentSystemEvent;
-import javax.faces.event.ExceptionQueuedEvent;
-import javax.faces.event.ExceptionQueuedEventContext;
-import javax.faces.event.PostConstructApplicationEvent;
-import javax.faces.event.PostConstructCustomScopeEvent;
-import javax.faces.event.PreDestroyApplicationEvent;
-import javax.faces.event.PreDestroyCustomScopeEvent;
-import javax.faces.event.ScopeContext;
-import javax.inject.Inject;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.Archives;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
-import org.jboss.test.faces.mock.application.MockApplication;
-import org.jboss.test.faces.mock.component.MockUIComponent;
-import org.jboss.test.faces.mock.context.MockFacesContext;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class SystemEventListenerTests
-{
-
-   @Deployment
-   public static JavaArchive createTestArchive()
-   {
-      return Archives.create("test.jar", JavaArchive.class).addClasses(SystemEventObserver.class, SystemEventListener.class, GenericEventListener.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
-   }
-
-   @Inject
-   SystemEventListener systemEventListener;
-
-   private final MockFacesContext facesContext = new MockFacesContext();
-   private final MockApplication application = new MockApplication();
-
-   @SuppressWarnings("serial")
-   @Test
-   public void testComponentSystemEventObserver()
-   {
-      systemEventListener.processEvent(new ComponentSystemEvent(new MockUIComponent())
-      {
-      });
-      assert SystemEventObserver.componentSystemEvent;
-   }
-
-   @Test
-   public void testExceptionQueuedEventObserver()
-   {
-      ExceptionQueuedEventContext eqec = new ExceptionQueuedEventContext(facesContext, new NullPointerException());
-      ExceptionQueuedEvent eqe = new ExceptionQueuedEvent(eqec);
-      systemEventListener.processEvent(eqe);
-      assert SystemEventObserver.excecptionQueuedEvent;
-   }
-
-   @Test
-   public void testPostConstructApplicationEventObserver()
-   {
-      systemEventListener.processEvent(new PostConstructApplicationEvent(application));
-      assert SystemEventObserver.postConstructApplicationEvent;
-   }
-
-   @Test
-   public void testPostConstructCustomScopeEvent()
-   {
-      ScopeContext sc = new ScopeContext("dummyscope", new HashMap<String, Object>());
-      systemEventListener.processEvent(new PostConstructCustomScopeEvent(sc));
-      assert SystemEventObserver.postConstructCustomScopeEvent;
-   }
-
-   @Test
-   public void testPreDestroyApplicationEventObserver()
-   {
-      systemEventListener.processEvent(new PreDestroyApplicationEvent(application));
-      assert SystemEventObserver.preDestroyApplicationEvent;
-   }
-
-   @Test
-   public void testPreDestroyCustomScopeEventObserver()
-   {
-      ScopeContext sc = new ScopeContext("dummyscope", new HashMap<String, Object>());
-      systemEventListener.processEvent(new PreDestroyCustomScopeEvent(sc));
-      assert SystemEventObserver.preDestroyCustomScopeEvent;
-   }
-
-}



More information about the seam-commits mailing list