[seam-commits] Seam SVN: r12827 - in modules/faces/trunk: examples/short-ly/src/main/resources/META-INF and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed May 26 18:01:56 EDT 2010


Author: lincolnthree
Date: 2010-05-26 18:01:55 -0400 (Wed, 26 May 2010)
New Revision: 12827

Modified:
   modules/faces/trunk/examples/short-ly/pom.xml
   modules/faces/trunk/examples/short-ly/src/main/resources/META-INF/persistence.xml
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java
   modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java
   modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java
Log:
Updated example pom for embedded glassfish plugin. Nullpointer on MessagesAdapter should be resolved (via workaround of bug: https://jira.jboss.org/browse/WELD-535)

Modified: modules/faces/trunk/examples/short-ly/pom.xml
===================================================================
--- modules/faces/trunk/examples/short-ly/pom.xml	2010-05-26 22:01:43 UTC (rev 12826)
+++ modules/faces/trunk/examples/short-ly/pom.xml	2010-05-26 22:01:55 UTC (rev 12827)
@@ -100,9 +100,9 @@
 				<version>3.0</version>
 				<configuration>
 					<goalPrefix>glassfish</goalPrefix>
-					<app>test.war</app>
+					<app>${project.build.directory}/${build.finalName}.war</app>
 					<port>8080</port>
-					<contextRoot>test</contextRoot>
+					<contextRoot>${build.finalName}</contextRoot>
 				</configuration>
 				<executions>
 					<execution>

Modified: modules/faces/trunk/examples/short-ly/src/main/resources/META-INF/persistence.xml
===================================================================
--- modules/faces/trunk/examples/short-ly/src/main/resources/META-INF/persistence.xml	2010-05-26 22:01:43 UTC (rev 12826)
+++ modules/faces/trunk/examples/short-ly/src/main/resources/META-INF/persistence.xml	2010-05-26 22:01:55 UTC (rev 12827)
@@ -5,9 +5,9 @@
 	version="2.0">
 	<persistence-unit name="example" transaction-type="JTA">
 		<provider>org.hibernate.ejb.HibernatePersistence</provider>
+		<jta-data-source> jdbc/__default </jta-data-source>
+		<!-- 
 		<jta-data-source> jdbc/mysql </jta-data-source>
-		<!-- 
-		<jta-data-source> jdbc/__default </jta-data-source>
 		<jta-data-source> java:app/Application_Level_DataSource </jta-data-source>
 		 -->
 		<exclude-unlisted-classes>false</exclude-unlisted-classes>

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java	2010-05-26 22:01:43 UTC (rev 12826)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java	2010-05-26 22:01:55 UTC (rev 12827)
@@ -24,7 +24,6 @@
 
 import java.io.Serializable;
 
-import javax.enterprise.context.SessionScoped;
 import javax.enterprise.event.Observes;
 import javax.faces.application.FacesMessage;
 import javax.faces.application.FacesMessage.Severity;
@@ -44,7 +43,6 @@
  * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
  * 
  */
- at SessionScoped
 public class MessagesAdapter implements Serializable
 {
    private static final long serialVersionUID = -2908193057765795662L;
@@ -53,7 +51,7 @@
    private Messages messages;
 
    @SuppressWarnings("unused")
-   private void convert(@Observes @Before @RenderResponse final PhaseEvent event)
+   void convert(@Observes @Before @RenderResponse final PhaseEvent event)
    {
       for (Message m : messages.getAll())
       {

Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java	2010-05-26 22:01:43 UTC (rev 12826)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/PhaseTestBase.java	2010-05-26 22:01:55 UTC (rev 12827)
@@ -41,7 +41,7 @@
    @Inject
    PhaseEventBridge phaseEventBridge;
 
-   protected final MockFacesContext facesContext = new MockFacesContext();
+   protected MockFacesContext facesContext = new MockFacesContext();
    protected final MockLifecycle lifecycle = new MockLifecycle();
 
    static List<PhaseId> ALL_PHASES = new ArrayList<PhaseId>()

Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java	2010-05-26 22:01:43 UTC (rev 12826)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java	2010-05-26 22:01:55 UTC (rev 12827)
@@ -39,6 +39,8 @@
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 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.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -58,8 +60,16 @@
    @Inject
    Messages messages;
 
+   @Before
+   public void before()
+   {
+      facesContext = new MockFacesContext();
+      facesContext.getControl().resetToNice();
+      facesContext.getControl().replay();
+   }
+
    @Test
-   public void testBeforeRenderResponseObserver()
+   public void testMessagesAreTransferredBeforeRenderResponse()
    {
       messages.add(messages.info("Hey! This is a message"));
       assertEquals(1, messages.getAll().size());
@@ -70,4 +80,15 @@
       // assertNotNull(facesContext.getMessages());
    }
 
+   @Test
+   public void testMessageTargetsTransferredToFacesMessageComponentId()
+   {
+      messages.add(messages.info("Hey! This is a message").targets("component"));
+      assertEquals(1, messages.getAll().size());
+
+      fireBeforePhase(PhaseId.RENDER_RESPONSE);
+
+      assertTrue(messages.getAll().isEmpty());
+      // assertNotNull(facesContext.getMessages("component"));
+   }
 }



More information about the seam-commits mailing list