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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Mar 17 06:47:09 EDT 2010


Author: nickarls
Date: 2010-03-17 06:47:07 -0400 (Wed, 17 Mar 2010)
New Revision: 12206

Added:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/
   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/main/java/org/jboss/seam/faces/event/qualifier/
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/After.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ComponentSystemEvent.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ExceptionQueuedEvent.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructApplicationEvent.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructCustomScopeEvent.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyApplicationEvent.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyCustomScopeEvent.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.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
Log:
Project set up for Arquillian + JSF mock + embedded Weld
PhaseListener -> CDI event propagation
Test stubs for simple case (to be extended)

Modified: modules/faces/trunk/pom.xml
===================================================================
--- modules/faces/trunk/pom.xml	2010-03-16 14:23:35 UTC (rev 12205)
+++ modules/faces/trunk/pom.xml	2010-03-17 10:47:07 UTC (rev 12206)
@@ -1,51 +1,90 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-   <modelVersion>4.0.0</modelVersion>
+	<modelVersion>4.0.0</modelVersion>
 
-   <parent>
-      <artifactId>seam-parent</artifactId>
-      <groupId>org.jboss.seam</groupId>
-      <version>3.0.0-SNAPSHOT</version>
-   </parent>
+	<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>
-   
-   <!-- Snapshots repo to get parent -->
-   <repositories>
-      <repository>
-         <id>oss.sonatype.org/jboss-snapshots</id>
-         <name>JBoss (Nexus) Snapshots Repository</name>
-         <url>http://oss.sonatype.org/content/repositories/jboss-snapshots</url>
-         <releases>
-            <enabled>false</enabled>
-         </releases>
-         <snapshots>
-            <enabled>true</enabled>
-            <updatePolicy>never</updatePolicy>
-         </snapshots>
-      </repository>
-   </repositories>
+	<properties>
+		<arquillian.version>1.0.0.Alpha1</arquillian.version>
+		<jsfmock.version>1.0.1-SNAPSHOT</jsfmock.version>
+	</properties>
 
-   <dependencies>
+	<artifactId>seam-faces</artifactId>
+	<version>3.0.0-SNAPSHOT</version>
+	<packaging>jar</packaging>
+	<name>Seam Faces Module</name>
 
-        <dependency>
-            <groupId>javax</groupId>
-            <artifactId>javaee-web-api</artifactId>
-            <version>6.0</version>
-            <scope>provided</scope>
-        </dependency>
+	<!-- Snapshots repo to get parent -->
+	<repositories>
+		<repository>
+			<id>oss.sonatype.org/jboss-snapshots</id>
+			<name>JBoss (Nexus) Snapshots Repository</name>
+			<url>http://oss.sonatype.org/content/repositories/jboss-snapshots</url>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+			<snapshots>
+				<enabled>true</enabled>
+				<updatePolicy>never</updatePolicy>
+			</snapshots>
+		</repository>
+	</repositories>
 
-   </dependencies>
-   
-   
-   <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>
-      <url>http://fisheye.jboss.org/browse/Seam/modules/faces/trunk</url>
-   </scm>
+	<dependencies>
 
+		<dependency>
+			<groupId>javax</groupId>
+			<artifactId>javaee-web-api</artifactId>
+			<version>6.0</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.enterprise</groupId>
+			<artifactId>cdi-api</artifactId>
+			<version>1.0-SP1</version>
+		</dependency>		
+
+		<dependency>
+			<groupId>org.testng</groupId>
+			<artifactId>testng</artifactId>
+			<version>5.10</version>
+			<classifier>jdk15</classifier>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jboss.arquillian</groupId>
+			<artifactId>arquillian-testng</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.test-jsf</groupId>
+			<artifactId>jsf-mock</artifactId>
+			<version>${jsfmock.version}</version>
+			<scope>test</scope>
+		</dependency>		
+
+	</dependencies>
+
+
+	<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>
+		<url>http://fisheye.jboss.org/browse/Seam/modules/faces/trunk</url>
+	</scm>
+
 </project>

Added: 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	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/GenericEventListener.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,16 @@
+package org.jboss.seam.faces.event;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.jboss.weld.Container;
+
+public class GenericEventListener
+{
+   @Inject BeanManager beanManager;
+   
+   protected BeanManager getBeanManager()
+   {
+      return beanManager != null ? beanManager : Container.instance().deploymentManager();
+   }
+}

Added: 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	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/PhaseEventListener.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,100 @@
+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;
+   }
+
+}

Added: 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	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/SystemEventListener.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,66 @@
+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/After.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/After.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/After.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface After {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ApplyRequestValues.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface ApplyRequestValues {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/Before.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface Before {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ComponentSystemEvent.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ComponentSystemEvent.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ComponentSystemEvent.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface ComponentSystemEvent {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ExceptionQueuedEvent.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ExceptionQueuedEvent.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ExceptionQueuedEvent.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface ExceptionQueuedEvent {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/InvokeApplication.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface InvokeApplication {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructApplicationEvent.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructApplicationEvent.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructApplicationEvent.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface PostConstructApplicationEvent {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructCustomScopeEvent.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructCustomScopeEvent.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PostConstructCustomScopeEvent.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface PostConstructCustomScopeEvent {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyApplicationEvent.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyApplicationEvent.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyApplicationEvent.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface PreDestroyApplicationEvent {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyCustomScopeEvent.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyCustomScopeEvent.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/PreDestroyCustomScopeEvent.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface PreDestroyCustomScopeEvent {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/ProcessValidations.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface ProcessValidations {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RenderResponse.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface RenderResponse {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/RestoreView.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface RestoreView {}
\ No newline at end of file

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/event/qualifier/UpdateModelValues.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,15 @@
+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;
+
+ at Qualifier
+ at Target({FIELD, PARAMETER})
+ at Retention(RUNTIME)
+public @interface UpdateModelValues {}
\ No newline at end of file

Added: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,28 @@
+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.Before;
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+
+ at ApplicationScoped
+public class Observer
+{
+   public static boolean observeBeforeRenderResponse;
+   public static boolean observeAfterRenderResponse;
+   
+   public void observeBeforeRenderResponse(@Observes @Before @RenderResponse PhaseEvent e) 
+   {
+      Observer.observeBeforeRenderResponse = true;
+   }
+   
+   public void observeAfterRenderResponse(@Observes @After @RenderResponse PhaseEvent e) 
+   {
+      Observer.observeAfterRenderResponse = true;
+   }
+   
+}
+

Added: 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	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,49 @@
+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.testng.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.MockFacesEnvironment;
+import org.jboss.test.faces.mock.lifecycle.MockLifecycle;
+import org.testng.annotations.Test;
+
+ at Test
+public class PhaseListenerTests extends Arquillian
+{
+
+   @Deployment
+   public static JavaArchive createTestArchive()
+   {
+      return Archives.create("test.jar", JavaArchive.class)
+         .addClasses(Observer.class, PhaseEventListener.class, GenericEventListener.class)
+         .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+   }
+
+   @Inject PhaseEventListener phaseEventListener;
+   @Inject Observer observer;
+
+   MockFacesEnvironment environment = MockFacesEnvironment.createEnvironment();
+   MockLifecycle lifecycle = new MockLifecycle();
+   
+   @Test
+   public void testBeforeRenderResponse()
+   {
+      phaseEventListener.beforePhase(new PhaseEvent(environment.getFacesContext(), PhaseId.RENDER_RESPONSE, lifecycle));
+      assert observer.observeBeforeRenderResponse;
+   }
+   
+   @Test
+   public void testAfterRenderResponse()
+   {
+      phaseEventListener.afterPhase(new PhaseEvent(environment.getFacesContext(), PhaseId.RENDER_RESPONSE, lifecycle));
+      assert observer.observeAfterRenderResponse;
+   }
+   
+}

Added: 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	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java	2010-03-17 10:47:07 UTC (rev 12206)
@@ -0,0 +1,6 @@
+package org.jboss.seam.faces.event;
+
+public class SystemEventListenerTests
+{
+
+}



More information about the seam-commits mailing list