[seam-commits] Seam SVN: r12267 - in modules/faces/trunk/src/test: resources and 6 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Mar 25 02:27:35 EDT 2010


Author: dan.j.allen
Date: 2010-03-25 02:27:35 -0400 (Thu, 25 Mar 2010)
New Revision: 12267

Added:
   modules/faces/trunk/src/test/resources/org/
   modules/faces/trunk/src/test/resources/org/jboss/
   modules/faces/trunk/src/test/resources/org/jboss/seam/
   modules/faces/trunk/src/test/resources/org/jboss/seam/faces/
   modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/
   modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/
   modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml
Removed:
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml
Modified:
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationBean.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest.java
Log:
fix conversation interceptor test


Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationBean.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationBean.java	2010-03-25 06:08:34 UTC (rev 12266)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationBean.java	2010-03-25 06:27:35 UTC (rev 12267)
@@ -3,28 +3,32 @@
  */
 package org.jboss.seam.faces.context.conversation;
 
-import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.Conversation;
+import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
- at ApplicationScoped
+ at RequestScoped
 public class BeginConversationBean
 {
-   @Inject
-   Conversation conversation;
+   @Inject Conversation conversation;
 
-   public boolean conversationStarted = false;
+   private boolean conversationLongRunningDuringInvocation = false;
 
    @Begin
    public void beginConversation()
    {
-      if (conversation.isTransient() == false)
+      if (!conversation.isTransient())
       {
-         conversationStarted = true;
+         conversationLongRunningDuringInvocation = true;
       }
    }
+
+   public boolean isConversationLongRunningInsideMethodCall() {
+      return conversationLongRunningDuringInvocation;
+   }
+
 }

Deleted: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml	2010-03-25 06:08:34 UTC (rev 12266)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml	2010-03-25 06:27:35 UTC (rev 12267)
@@ -1,10 +0,0 @@
-<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="
-      http://java.sun.com/xml/ns/javaee
-      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
-
-	<interceptors>
-		<class>org.jboss.seam.faces.context.conversation.BeginConversationInterceptor</class>
-	</interceptors>
-
-</beans>
\ No newline at end of file

Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest.java	2010-03-25 06:08:34 UTC (rev 12266)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest.java	2010-03-25 06:27:35 UTC (rev 12267)
@@ -3,24 +3,29 @@
  */
 package org.jboss.seam.faces.context.conversation;
 
+import javax.enterprise.context.Conversation;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 
 import javax.inject.Inject;
 
 import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.faces.MockConversation;
 import org.jboss.seam.faces.MockLogger;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.internal.runners.statements.Fail;
+import org.junit.runner.RunWith;
 
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  * 
  */
-// @RunWith(Arquillian.class)
+ at RunWith(Arquillian.class)
 public class BeginConversationInterceptorTest
 {
    @Deployment
@@ -29,14 +34,21 @@
       return Archives.create("test.jar", JavaArchive.class).addClasses(BeginConversationInterceptor.class, BeginConversationBean.class, MockLogger.class, MockConversation.class).addManifestResource(BeginConversationInterceptorTest.class.getPackage().getName().replaceAll("\\.", "/") + "/BeginConversationInterceptorTest-beans.xml", ArchivePaths.create("beans.xml"));
    }
 
-   @Inject
-   private BeginConversationBean bean;
+   @Inject Conversation conversation;
 
-   // @Test
-   @Category(Fail.class)
+   @Inject private BeginConversationBean interceptedBean;
+
+   @Test
+   //@Category(Fail.class)
    public void testConversationStarted()
    {
-      bean.beginConversation();
-      assertTrue(bean.conversationStarted);
+      // assert fixtures
+      assertTrue(conversation.isTransient());
+      assertFalse(interceptedBean.isConversationLongRunningInsideMethodCall());
+
+      interceptedBean.beginConversation();
+
+      assertFalse(conversation.isTransient());
+      assertTrue(interceptedBean.isConversationLongRunningInsideMethodCall());
    }
 }

Copied: modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml (from rev 12265, modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml)
===================================================================
--- modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml	                        (rev 0)
+++ modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml	2010-03-25 06:27:35 UTC (rev 12267)
@@ -0,0 +1,10 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee
+      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+	<interceptors>
+		<class>org.jboss.seam.faces.context.conversation.BeginConversationInterceptor</class>
+	</interceptors>
+
+</beans>
\ No newline at end of file



More information about the seam-commits mailing list