[seam-commits] Seam SVN: r12312 - in modules/faces/trunk/src: main/java/org/jboss/seam/faces/context/conversation and 6 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Mar 29 16:36:48 EDT 2010


Author: lincolnthree
Date: 2010-03-29 16:36:45 -0400 (Mon, 29 Mar 2010)
New Revision: 12312

Added:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java
   modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest-beans.xml
Removed:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptor.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationAnnotationExtension.java
   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
   modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml
Modified:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java
   modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
Log:
@Begin and @End annotations are both functional - ConversationBoundary support alpha.

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java	2010-03-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/Begin.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -20,6 +20,7 @@
  * 
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  */
+ at ConversationBoundary
 @InterceptorBinding
 @Target( { METHOD, TYPE })
 @Retention(RUNTIME)

Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptor.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptor.java	2010-03-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptor.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -1,87 +0,0 @@
-/**
- * 
- */
-package org.jboss.seam.faces.context.conversation;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
-import javax.enterprise.context.Conversation;
-import javax.inject.Inject;
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-
-import org.slf4j.Logger;
-
-/**
- * Intercepts methods annotated as Conversational entry points.
- * 
- * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
- * 
- */
- at Begin
- at Interceptor
-// TODO try having @Begin and @End extend @ConversationAnno.. to converge into a
-// single interceptor
-public class BeginConversationInterceptor implements Serializable
-{
-   @Inject
-   Logger log;
-
-   @Inject
-   Conversation conversation;
-
-   @AroundInvoke
-   public Object before(final InvocationContext ctx) throws Exception
-   {
-      String cid = getConversationId(ctx.getMethod());
-      if (cid != null)
-      {
-         conversation.begin(cid);
-      }
-      else
-      {
-         conversation.begin();
-      }
-
-      log.debug("Began conversation: (#0) on method: (#1.#2(...))", new Object[] { conversation.getId(), ctx.getMethod().getDeclaringClass().getName(), ctx.getMethod().getName() });
-
-      try
-      {
-         Object result = ctx.proceed();
-         return result;
-      }
-      catch (Exception e)
-      {
-         conversation.end();
-         throw e;
-      }
-
-   }
-
-   private String getConversationId(final Method m)
-   {
-      String result = null;
-      for (Annotation a : m.getAnnotations())
-      {
-         if (a.annotationType().isAnnotationPresent(Begin.class))
-         {
-            result = a.annotationType().getAnnotation(Begin.class).id();
-         }
-      }
-
-      if (result == null)
-      {
-         for (Annotation a : m.getDeclaringClass().getAnnotations())
-         {
-            if (a.annotationType().isAnnotationPresent(Begin.class))
-            {
-               result = a.annotationType().getAnnotation(Begin.class).id();
-            }
-         }
-      }
-      return result;
-   }
-}

Deleted: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationAnnotationExtension.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationAnnotationExtension.java	2010-03-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationAnnotationExtension.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -1,34 +0,0 @@
-/**
- * 
- */
-package org.jboss.seam.faces.context.conversation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.Extension;
-
-import org.jboss.weld.manager.BeanManagerImpl;
-
-/**
- * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
- * 
- */
-public class ConversationAnnotationExtension implements Extension
-{
-   public void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery event, final BeanManager manager)
-   {
-      if (manager instanceof BeanManagerImpl)
-      {
-         BeanManagerImpl impl = (BeanManagerImpl) manager;
-
-         List<Class<?>> list = new ArrayList<Class<?>>();
-         list.addAll(impl.getEnabledInterceptorClasses());
-         list.add(BeginConversationInterceptor.class);
-         impl.setEnabledInterceptorClasses(list);
-      }
-   }
-}

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundary.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -0,0 +1,24 @@
+package org.jboss.seam.faces.context.conversation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * Parent annotation for @{@link Begin} and @{@link End}
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ */
+ at InterceptorBinding
+ at Inherited
+ at Target( { METHOD, TYPE })
+ at Retention(RUNTIME)
+ at interface ConversationBoundary
+{
+}
\ No newline at end of file

Copied: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java (from rev 12311, modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptor.java)
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptor.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -0,0 +1,108 @@
+/**
+ * 
+ */
+package org.jboss.seam.faces.context.conversation;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.seam.faces.util.Annotations;
+import org.slf4j.Logger;
+
+/**
+ * Intercepts methods annotated as Conversational entry points.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+ at ConversationBoundary
+ at Interceptor
+public class ConversationBoundaryInterceptor implements Serializable
+{
+   private static final long serialVersionUID = -2729227895205287477L;
+
+   @Inject
+   Logger log;
+
+   @Inject
+   Conversation conversation;
+
+   @AroundInvoke
+   public Object before(final InvocationContext ctx) throws Exception
+   {
+      Object result = null;
+      if (Annotations.hasAnnotation(ctx.getMethod(), Begin.class))
+      {
+         result = beginConversation(ctx);
+      }
+
+      if (Annotations.hasAnnotation(ctx.getMethod(), End.class))
+      {
+         endConversation(ctx);
+      }
+
+      return result;
+   }
+
+   private Object beginConversation(final InvocationContext ctx) throws Exception
+   {
+      String cid = getConversationId(ctx.getMethod());
+      if (cid != null)
+      {
+         conversation.begin(cid);
+      }
+      else
+      {
+         conversation.begin();
+      }
+
+      log.debug("Began conversation: (#0) on method: (#1.#2(...))", new Object[] { conversation.getId(), ctx.getMethod().getDeclaringClass().getName(), ctx.getMethod().getName() });
+
+      try
+      {
+         Object result = ctx.proceed();
+         return result;
+      }
+      catch (Exception e)
+      {
+         conversation.end();
+         throw e;
+      }
+   }
+
+   private void endConversation(final InvocationContext ctx)
+   {
+      conversation.end();
+   }
+
+   private String getConversationId(final Method m)
+   {
+      String result = null;
+      for (Annotation a : m.getAnnotations())
+      {
+         if (a.annotationType().isAnnotationPresent(Begin.class))
+         {
+            result = a.annotationType().getAnnotation(Begin.class).id();
+         }
+      }
+
+      if (result == null)
+      {
+         for (Annotation a : m.getDeclaringClass().getAnnotations())
+         {
+            if (a.annotationType().isAnnotationPresent(Begin.class))
+            {
+               result = a.annotationType().getAnnotation(Begin.class).id();
+            }
+         }
+      }
+      return result;
+   }
+}

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java	2010-03-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/conversation/End.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -20,6 +20,7 @@
  * 
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  */
+ at ConversationBoundary
 @InterceptorBinding
 @Target( { METHOD, TYPE })
 @Retention(RUNTIME)

Added: modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java	                        (rev 0)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/util/Annotations.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -0,0 +1,78 @@
+package org.jboss.seam.faces.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import javax.enterprise.inject.Stereotype;
+
+/**
+ * Utility class for common @{@link Annotation} operations.
+ * <p>
+ * TODO: This should probably go into weld-extensions so other portable
+ * extensions can leverage it.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+public class Annotations
+{
+   /**
+    * Discover if a Method <b>m</b> has been annotated with <b>type</b>. This
+    * also discovers annotations defined through a @{@link Stereotype}.
+    * 
+    * @return True if annotation is present either on the method itself, or on
+    *         the declaring class of the method. Returns false if the annotation
+    *         is not present.
+    */
+   public static boolean hasAnnotation(final Method m, final Class<? extends Annotation> type)
+   {
+      boolean result = false;
+      if (m.isAnnotationPresent(type))
+      {
+         result = true;
+      }
+      else
+      {
+         for (Annotation a : m.getAnnotations())
+         {
+            if (a.annotationType().isAnnotationPresent(type))
+            {
+               result = true;
+            }
+         }
+      }
+
+      if (result == false)
+      {
+         result = hasAnnotation(m.getDeclaringClass(), type);
+      }
+      return result;
+   }
+
+   /**
+    * Discover if a Class <b>c</b> has been annotated with <b>type</b>. This
+    * also discovers annotations defined through a @{@link Stereotype}.
+    * 
+    * @return True if annotation is present either on class, false if the
+    *         annotation is not present.
+    */
+   public static boolean hasAnnotation(final Class<?> c, final Class<? extends Annotation> type)
+   {
+      boolean result = false;
+      if (c.isAnnotationPresent(type))
+      {
+         result = true;
+      }
+      else
+      {
+         for (Annotation a : c.getAnnotations())
+         {
+            if (a.annotationType().isAnnotationPresent(type))
+            {
+               result = true;
+            }
+         }
+      }
+      return result;
+   }
+}

Modified: modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
===================================================================
--- modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension	2010-03-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension	2010-03-29 20:36:45 UTC (rev 12312)
@@ -1,3 +1,2 @@
 org.jboss.seam.faces.context.ViewScopedExtension
-org.jboss.seam.faces.context.FlashScopedExtension
-org.jboss.seam.faces.context.conversation.ConversationAnnotationExtension
\ No newline at end of file
+org.jboss.seam.faces.context.FlashScopedExtension
\ No newline at end of file

Deleted: 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-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationBean.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -1,34 +0,0 @@
-/**
- * 
- */
-package org.jboss.seam.faces.context.conversation;
-
-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 RequestScoped
-public class BeginConversationBean
-{
-   @Inject Conversation conversation;
-
-   private boolean conversationLongRunningDuringInvocation = false;
-
-   @Begin
-   public void beginConversation()
-   {
-      if (!conversation.isTransient())
-      {
-         conversationLongRunningDuringInvocation = true;
-      }
-   }
-
-   public boolean isConversationLongRunningInsideMethodCall() {
-      return conversationLongRunningDuringInvocation;
-   }
-
-}

Deleted: 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-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -1,54 +0,0 @@
-/**
- * 
- */
-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>
- * 
- */
- at RunWith(Arquillian.class)
-public class BeginConversationInterceptorTest
-{
-   @Deployment
-   public static JavaArchive createTestArchive()
-   {
-      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 Conversation conversation;
-
-   @Inject private BeginConversationBean interceptedBean;
-
-   @Test
-   //@Category(Fail.class)
-   public void testConversationStarted()
-   {
-      // assert fixtures
-      assertTrue(conversation.isTransient());
-      assertFalse(interceptedBean.isConversationLongRunningInsideMethodCall());
-
-      interceptedBean.beginConversation();
-
-      assertFalse(conversation.isTransient());
-      assertTrue(interceptedBean.isConversationLongRunningInsideMethodCall());
-   }
-}

Copied: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java (from rev 12311, 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/ConversationBoundaryInterceptorTest.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -0,0 +1,64 @@
+/**
+ * 
+ */
+package org.jboss.seam.faces.context.conversation;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import javax.enterprise.context.Conversation;
+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.runner.RunWith;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ * 
+ */
+ at RunWith(Arquillian.class)
+public class ConversationBoundaryInterceptorTest
+{
+   @Deployment
+   public static JavaArchive createTestArchive()
+   {
+      return Archives.create("test.jar", JavaArchive.class).addClasses(ConversationBoundaryInterceptor.class, ConversationalBean.class, MockLogger.class, MockConversation.class).addManifestResource(ConversationBoundaryInterceptorTest.class.getPackage().getName().replaceAll("\\.", "/") + "/ConversationBoundaryInterceptorTest-beans.xml", ArchivePaths.create("beans.xml"));
+   }
+
+   @Inject
+   Conversation conversation;
+
+   @Inject
+   private ConversationalBean interceptedBean;
+
+   @Test
+   public void testConversationStarted()
+   {
+      assertTrue(conversation.isTransient());
+      assertFalse(interceptedBean.isConversationLongRunningInsideMethodCall());
+
+      interceptedBean.beginConversation();
+
+      assertFalse(conversation.isTransient());
+      assertTrue(interceptedBean.isConversationLongRunningInsideMethodCall());
+   }
+
+   @Test
+   public void testConversationBeginsAndEnds()
+   {
+      assertTrue(conversation.isTransient());
+      assertFalse(interceptedBean.isConversationLongRunningDuringInvocation2());
+
+      interceptedBean.beginAndEndConversation();
+
+      assertTrue(conversation.isTransient());
+      assertTrue(interceptedBean.isConversationLongRunningDuringInvocation2());
+   }
+}

Copied: modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java (from rev 12311, 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/ConversationalBean.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/context/conversation/ConversationalBean.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -0,0 +1,55 @@
+/**
+ * 
+ */
+package org.jboss.seam.faces.context.conversation;
+
+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 RequestScoped
+public class ConversationalBean
+{
+   @Inject
+   Conversation conversation;
+
+   private boolean conversationLongRunningDuringInvocation = false;
+
+   private boolean conversationLongRunningDuringInvocation2;
+
+   @Begin
+   public void beginConversation()
+   {
+      if (!conversation.isTransient())
+      {
+         conversationLongRunningDuringInvocation = true;
+      }
+   }
+
+   @Begin
+   @End
+   public void beginAndEndConversation()
+   {
+      conversationLongRunningDuringInvocation2 = true;
+   }
+
+   public boolean isConversationLongRunningDuringInvocation2()
+   {
+      return conversationLongRunningDuringInvocation2;
+   }
+
+   public void setConversationLongRunningDuringInvocation2(final boolean conversationLongRunningDuringInvocation2)
+   {
+      this.conversationLongRunningDuringInvocation2 = conversationLongRunningDuringInvocation2;
+   }
+
+   public boolean isConversationLongRunningInsideMethodCall()
+   {
+      return conversationLongRunningDuringInvocation;
+   }
+
+}

Added: modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationTestObject.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -0,0 +1,19 @@
+package org.jboss.seam.faces.util;
+
+import org.jboss.seam.faces.context.conversation.Begin;
+import org.jboss.seam.faces.context.conversation.End;
+
+ at Begin
+public class AnnotationTestObject
+{
+
+   public void begin()
+   {
+   }
+
+   @End
+   public void end()
+   {
+   }
+
+}

Added: modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/util/AnnotationsTest.java	2010-03-29 20:36:45 UTC (rev 12312)
@@ -0,0 +1,46 @@
+package org.jboss.seam.faces.util;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Method;
+
+import org.jboss.seam.faces.context.conversation.Begin;
+import org.jboss.seam.faces.context.conversation.End;
+import org.junit.Test;
+
+/**
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+public class AnnotationsTest
+{
+   @Test
+   public void testHasAnnotationOnClassDirectly() throws Exception
+   {
+      Method begin = AnnotationTestObject.class.getMethod("begin", new Class[] {});
+
+      assertTrue(Annotations.hasAnnotation(begin, Begin.class));
+      assertFalse(Annotations.hasAnnotation(begin, End.class));
+   }
+
+   @Test
+   public void testHasAnnotationOnMethodDirectly() throws Exception
+   {
+      Method end = AnnotationTestObject.class.getMethod("end", new Class[] {});
+
+      assertTrue(Annotations.hasAnnotation(end, End.class));
+   }
+
+   @Test
+   public void testHasAnnotationOnMethodIndirectlyFromClass() throws Exception
+   {
+      Method begin = AnnotationTestObject.class.getMethod("begin", new Class[] {});
+      Method end = AnnotationTestObject.class.getMethod("end", new Class[] {});
+
+      assertTrue(Annotations.hasAnnotation(begin, Begin.class));
+      assertTrue(Annotations.hasAnnotation(end, Begin.class));
+   }
+
+}

Deleted: modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml
===================================================================
--- modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml	2010-03-29 16:26:07 UTC (rev 12311)
+++ modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml	2010-03-29 20:36:45 UTC (rev 12312)
@@ -1,12 +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

Copied: modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest-beans.xml (from rev 12311, modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/BeginConversationInterceptorTest-beans.xml)
===================================================================
--- modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest-beans.xml	                        (rev 0)
+++ modules/faces/trunk/src/test/resources/org/jboss/seam/faces/context/conversation/ConversationBoundaryInterceptorTest-beans.xml	2010-03-29 20:36:45 UTC (rev 12312)
@@ -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.ConversationBoundaryInterceptor</class>
+	</interceptors>
+
+</beans>
\ No newline at end of file



More information about the seam-commits mailing list