[webbeans-commits] Webbeans SVN: r3251 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/normal/scope and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Jul 26 14:57:47 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-07-26 14:57:47 -0400 (Sun, 26 Jul 2009)
New Revision: 3251

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/normal/scope/NormalScopedBeanWithInjectionPoint.java
Log:
Fix test

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-07-26 18:52:49 UTC (rev 3250)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-07-26 18:57:47 UTC (rev 3251)
@@ -32,6 +32,7 @@
 import javax.enterprise.inject.Specializes;
 import javax.enterprise.inject.deployment.Standard;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.stereotype.Stereotype;
 
 import org.jboss.webbeans.BeanManagerImpl;
@@ -157,6 +158,7 @@
       initSerializable();
       initProxyable();
       initInjectionPoints();
+      checkInjectionPoints();
       initDecorates();
       checkDecorates();
    }
@@ -293,6 +295,19 @@
       }
       return true;
    }
+   
+   protected boolean checkInjectionPoints()
+   {
+      // TODO Merge serializable check in here
+      for (WBInjectionPoint<?, ?> injectionPoint : getAnnotatedInjectionPoints())
+      {
+         if (!getScopeType().equals(Dependent.class) && injectionPoint.getType().equals(InjectionPoint.class))
+         {
+            throw new DefinitionException("Cannot inject an InjectionPoint into a non @Dependent scoped bean " + injectionPoint); 
+         }
+      }
+      return true;
+   }
 
    /**
     * Initializes the scope type

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/normal/scope/NormalScopedBeanWithInjectionPoint.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/normal/scope/NormalScopedBeanWithInjectionPoint.java	2009-07-26 18:52:49 UTC (rev 3250)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/broken/normal/scope/NormalScopedBeanWithInjectionPoint.java	2009-07-26 18:57:47 UTC (rev 3251)
@@ -17,6 +17,7 @@
 package org.jboss.jsr299.tck.tests.lookup.injectionpoint.broken.normal.scope;
 
 import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
 import org.jboss.jsr299.tck.DefinitionError;
 import org.jboss.testharness.impl.packaging.Artifact;
 import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
@@ -28,12 +29,14 @@
  */
 @Artifact
 @ExpectedDeploymentException(DefinitionError.class)
-public class NormalScopedBeanWithInjectionPoint {
-	
-	@Test(groups = { "injectionPoint", "ri-broken" })
-	@SpecAssertion(section="5.6.9", id="f")
-	public void testSessionScopedBeanWithInjectionPoint() {
-		assert false;
-	}
+public class NormalScopedBeanWithInjectionPoint extends AbstractJSR299Test
+{
 
+   @Test(groups = { "injectionPoint"})
+   @SpecAssertion(section = "5.6.9", id = "f")
+   public void testSessionScopedBeanWithInjectionPoint()
+   {
+      assert false;
+   }
+
 }




More information about the weld-commits mailing list