[webbeans-commits] Webbeans SVN: r1209 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Jan 23 14:55:54 EST 2009


Author: dallen6
Date: 2009-01-23 14:55:53 -0500 (Fri, 23 Jan 2009)
New Revision: 1209

Added:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowConsumer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderConsumer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderConsumer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer_Broken.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderAsAnimalProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderProducerWildCardType_Broken.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderStereotype.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/StaticTarantulaProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameAnnotationLiteral.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameTarantulaProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpider.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpiderImpl_Broken.java
Removed:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer_Broken.java
Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldLifecycleTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/Spider.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaConsumer.java
Log:
Changed producer field tests to only use test framework and manager.

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-01-23 18:44:32 UTC (rev 1208)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -160,7 +160,7 @@
       {
          if (!(type instanceof Class))
          {
-            throw new DefinitionException("Producer type cannot be parameterized with type parameter or wildcard");
+            throw new DefinitionException("Producer type cannot be parameterized with type parameter or wildcard:\n" + this.getAnnotatedItem());
          }
       }
    }

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowConsumer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowConsumer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowConsumer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Current;
+
+/**
+ * This simple bean contains an injection point to receive the value of a
+ * producer field in another bean.
+ * 
+ * @author David Allen
+ * 
+ */
+public class BlackWidowConsumer
+{
+   @Current
+   private BlackWidow injectedSpider;
+
+   public BlackWidow getInjectedSpider()
+   {
+      return injectedSpider;
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowConsumer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowProducer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Named;
+import javax.webbeans.Produces;
+
+public class BlackWidowProducer
+{
+   public static BlackWidow blackWidow = new BlackWidow();
+   @Produces
+   @Named("blackWidow")
+   public BlackWidow produceBlackWidow = blackWidow;
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/BlackWidowProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderConsumer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderConsumer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderConsumer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Current;
+
+public class FunnelWeaverSpiderConsumer
+{
+   @Current
+   private FunnelWeaver<Spider> injectedSpider;
+
+   public FunnelWeaver<Spider> getInjectedSpider()
+   {
+      return injectedSpider;
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderConsumer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderProducer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,19 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Produces;
+
+public class FunnelWeaverSpiderProducer
+{
+   private static FunnelWeaver<Spider> spider;
+   @Produces public FunnelWeaver<Spider> getFunnelWeaverSpider = new FunnelWeaver<Spider>();
+
+   public FunnelWeaverSpiderProducer()
+   {
+      spider = this.getFunnelWeaverSpider;
+   }
+   
+   public static FunnelWeaver<Spider> getSpider()
+   {
+      return spider;
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/FunnelWeaverSpiderProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderConsumer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderConsumer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderConsumer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import java.io.Serializable;
+
+import javax.webbeans.Current;
+
+/**
+ * Simple bean that has an injection point for a spider
+ * 
+ * @author David Allen
+ * 
+ */
+public class NullSpiderConsumer implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   @Current
+   private BlackWidow injectedSpider;
+
+   public BlackWidow getInjectedSpider()
+   {
+      return injectedSpider;
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderConsumer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Named;
+import javax.webbeans.Produces;
+
+/**
+ * Contains producer for Spider which always is a null value and
+ * in Dependent scope
+ * 
+ * @author David Allen
+ *
+ */
+public class NullSpiderProducer
+{
+   @Produces @Named("blackWidow") public BlackWidow produceBlackWidow = null;
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer_Broken.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer_Broken.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Named;
+import javax.webbeans.Produces;
+import javax.webbeans.RequestScoped;
+
+/**
+ * Bean with a producer field that always returns null and is not
+ * in Dependent context (the produced result)
+ * 
+ * @author David Allen
+ *
+ */
+public class NullSpiderProducer_Broken
+{
+   @Produces @RequestScoped @Named("blackWidow") public BlackWidow produceBlackWidow = null;
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/NullSpiderProducer_Broken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer.java	2009-01-23 18:44:32 UTC (rev 1208)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -3,7 +3,6 @@
 import javax.webbeans.Named;
 import javax.webbeans.Produces;
 import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
 
 
 @AnotherDeploymentType
@@ -16,9 +15,10 @@
    
    @Produces public static Tarantula produceTarantula = new Tarantula();
    
-   @Produces @Named("blackWidow") public BlackWidow produceBlackWidow = new BlackWidow();
+   public static BlackWidow blackWidow = new BlackWidow();
+   @Produces @Named("blackWidow") public BlackWidow produceBlackWidow = blackWidow;
    
-   @Produces @Named @RequestScoped public DaddyLongLegs produceDaddyLongLegs = new DaddyLongLegs();
+   //@Produces @Named @RequestScoped public DaddyLongLegs produceDaddyLongLegs = new DaddyLongLegs();
    
    @Produces @Named @Production public LadybirdSpider getLadybirdSpider = new LadybirdSpider();
    
@@ -26,12 +26,10 @@
    
    @Produces public Animal makeASpider = new WolfSpider();
    
-   @Produces public int getWolfSpiderSize = 4;
+   @Produces @Named("SpiderSize") public int getWolfSpiderSize = 4;
    
    @Produces public Spider[] getSpiders = ALL_SPIDERS;
    
-   @Produces public FunnelWeaver<?> getAnotherFunnelWeaver = new FunnelWeaver<Object>();
-   
    @Produces public FunnelWeaver<Spider> getFunnelWeaverSpider = new FunnelWeaver<Spider>();
    
    @Produces public Spider getNullSpider =  null;

Deleted: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer_Broken.java	2009-01-23 18:44:32 UTC (rev 1208)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/OtherSpiderProducer_Broken.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -1,33 +0,0 @@
-package org.jboss.webbeans.tck.unit.implementation.producer.field;
-
-import javax.webbeans.Disposes;
-import javax.webbeans.Observes;
-import javax.webbeans.Produces;
-import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
-
- at Production
-class OtherSpiderProducer_Broken
-{
-
-   @Produces
-   public String observe(@Observes String foo)
-   {
-      return "foo";
-   }
-   
-   @Produces
-   public String dispose(@Disposes String foo)
-   {
-      return "foo";
-   }
-   
-   @Produces
-   public String destroy()
-   {
-      return "foo";
-   }
-   
-   @Produces @RequestScoped public Spider getRequestScopedSpider = null;
-   
-}

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldDefinitionTest.java	2009-01-23 18:44:32 UTC (rev 1208)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldDefinitionTest.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -1,8 +1,7 @@
 package org.jboss.webbeans.tck.unit.implementation.producer.field;
 
-import java.lang.reflect.Field;
+import java.util.Set;
 
-import javax.webbeans.Current;
 import javax.webbeans.DefinitionException;
 import javax.webbeans.Production;
 import javax.webbeans.RequestScoped;
@@ -11,266 +10,435 @@
 import org.jboss.webbeans.tck.AbstractTest;
 import org.jboss.webbeans.tck.impl.SpecAssertion;
 import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.impl.literals.CurrentBinding;
 import org.testng.annotations.Test;
 
- at SpecVersion("20081206")
+ at SpecVersion("PRD2")
 public class ProducerFieldDefinitionTest extends AbstractTest
 {
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="2.5.3")
+
+   /**
+    * By default, if no deployment type annotation is explicitly specified, a
+    * producer method or field inherits the deployment type of the bean in which
+    * it is defined.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = { "producerField", "broken" })
+   @SpecAssertion(section = "2.5.3")
    public void testProducerFieldInheritsDeploymentTypeOfDeclaringWebBean() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceTameTarantula");
-      Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
-      tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
+      deployBeans(TarantulaProducer.class, TarantulaConsumer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class);
+            assert !tarantulaBeans.isEmpty();
+            assert tarantulaBeans.iterator().next().getDeploymentType().equals(AnotherDeploymentType.class);
+         }
+      }.run();
    }
-   
-   /*@Test(groups="producerField", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
-   public void testStaticField() throws Exception
-   {
-      SimpleBean<BeanWithStaticProducerField> bean = createSimpleBean(BeanWithStaticProducerField.class);
-      manager.addBean(bean);
-      Field field = BeanWithStaticProducerField.class.getField("getString");
-      createProducerFieldBean(String.class, field, bean);
-   }*/
-   
-   @Test(groups={"stub", "producerField", "enterpriseBeans", "stub"}, expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
+
+   /*
+    * @Test(groups="producerField",
+    * expectedExceptions=DefinitionException.class)
+    * 
+    * @SpecAssertion(section="3.5") public void testStaticField() throws
+    * Exception { SimpleBean<BeanWithStaticProducerField> bean =
+    * createSimpleBean(BeanWithStaticProducerField.class);
+    * manager.addBean(bean); Field field =
+    * BeanWithStaticProducerField.class.getField("getString");
+    * createProducerFieldBean(String.class, field, bean); }
+    */
+
+   @Test(groups = { "broken", "producerField", "enterpriseBeans" }, expectedExceptions = DefinitionException.class)
+   @SpecAssertion(section = "3.5")
    public void testProducerFieldIsNotBusinessField() throws Exception
    {
-      assert false;
+      deployBeans(VibratingSpiderImpl_Broken.class);
    }
-   
-   @Test(groups="producerField") @SpecAssertion(section="3.5")
+
+   /**
+    * If the producer field return type is a parameterized type, it must specify
+    * actual type parameters for each type parameter.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField")
+   @SpecAssertion(section = "3.5")
    public void testParameterizedReturnType() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("getFunnelWeaverSpider");
-      createProducerFieldBean(field, bean);
+      deployBeans(FunnelWeaverSpiderProducer.class, FunnelWeaverSpiderConsumer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            FunnelWeaverSpiderConsumer spiderConsumer = manager.getInstanceByType(FunnelWeaverSpiderConsumer.class);
+            assert spiderConsumer != null;
+            assert spiderConsumer.getInjectedSpider() != null;
+            assert spiderConsumer.getInjectedSpider().equals(FunnelWeaverSpiderProducer.getSpider());
+         }
+      }.run();
    }
-   
-   @Test(groups="producerField", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.5")
-   public void testParameterizedReturnTypeWithWildcard() throws Exception
+
+   /**
+    * If the producer field return type is a parameterized type, it must specify
+    * actual type parameters for each type parameter. If a producer field return
+    * type contains a wildcard type parameter or type variable, a
+    * DefinitionException is thrown by the container at deployment time.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField", expectedExceptions = DefinitionException.class)
+   @SpecAssertion(section = "3.5")
+   public void testParameterizedReturnTypeWithWildcard()
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("getAnotherFunnelWeaver");
-      createProducerFieldBean(field, bean);
+      deployBeans(SpiderProducerWildCardType_Broken.class);
    }
-   
-   @Test(groups={"stub", "producerField", "deployment"}) @SpecAssertion(section="3.5")
+
+   @Test(groups = { "stub", "producerField", "deployment" })
+   @SpecAssertion(section = "3.5")
    public void testBeanDeclaresMultipleProducerFields()
    {
       assert false;
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section={"3.5", "2.3.1"})
+
+   @Test(groups = "producerField")
+   @SpecAssertion(section = { "3.5", "2.3.1" })
    public void testDefaultBindingType() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceTarantula");
-      Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
-      assert tarantulaModel.getBindings().size() == 1;
-      assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Current.class);
+      deployBeans(StaticTarantulaProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class);
+            assert !tarantulaBeans.isEmpty();
+            assert tarantulaBeans.iterator().next().getBindings().contains(new CurrentBinding());
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.1")
+
+   /**
+    * If the field type is a class, the set of bean types contains the field
+    * type, every superclass and all interfaces it implements directly or
+    * indirectly.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField")
+   @SpecAssertion(section = "3.5.1")
    public void testApiTypeForClassReturn() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceTarantula");
-      Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
-      assert tarantulaModel.getTypes().size() == 6;
-      assert tarantulaModel.getTypes().contains(Tarantula.class);
-      assert tarantulaModel.getTypes().contains(DeadlySpider.class);
-      assert tarantulaModel.getTypes().contains(Spider.class);
-      assert tarantulaModel.getTypes().contains(Animal.class);
-      assert tarantulaModel.getTypes().contains(DeadlyAnimal.class);
-      assert tarantulaModel.getTypes().contains(Object.class);
+      deployBeans(StaticTarantulaProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class);
+            assert !tarantulaBeans.isEmpty();
+            Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
+            assert tarantulaModel.getTypes().size() == 6;
+            assert tarantulaModel.getTypes().contains(Tarantula.class);
+            assert tarantulaModel.getTypes().contains(DeadlySpider.class);
+            assert tarantulaModel.getTypes().contains(Spider.class);
+            assert tarantulaModel.getTypes().contains(Animal.class);
+            assert tarantulaModel.getTypes().contains(DeadlyAnimal.class);
+            assert tarantulaModel.getTypes().contains(Object.class);
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.1")
+
+   /**
+    * If the field type is an interface, the set of bean types contains the
+    * field type, all interfaces it extends directly or indir- ectly and
+    * java.lang.Object.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = { "producerField" })
+   @SpecAssertion(section = "3.5.1")
    public void testApiTypeForInterfaceReturn() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("makeASpider");
-      Bean<Animal> animalModel = createProducerFieldBean(field, bean);
-      assert animalModel.getTypes().size() == 2;
-      assert animalModel.getTypes().contains(Animal.class);
-      assert animalModel.getTypes().contains(Object.class);
+      deployBeans(SpiderAsAnimalProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Animal>> animalBeans = manager.resolveByType(Animal.class);
+            assert !animalBeans.isEmpty();
+            Bean<Animal> animalModel = animalBeans.iterator().next();
+            assert animalModel.getTypes().size() == 2;
+            assert animalModel.getTypes().contains(Animal.class);
+            assert animalModel.getTypes().contains(Object.class);
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.1")
+
+   /**
+    * If a field type is primitive or is a Java array type, the set of bean
+    * types contains exactly two types: the field type and java.lang.Object.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = { "producerField", "broken" })
+   @SpecAssertion(section = "3.5.1")
    public void testApiTypeForPrimitiveReturn() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("getWolfSpiderSize");
-      Bean<Integer> intModel = createProducerFieldBean(field, bean);
-      assert intModel.getTypes().size() == 2;
-      assert intModel.getTypes().contains(int.class);
-      assert intModel.getTypes().contains(Object.class);
+      deployBeans(OtherSpiderProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<?>> beans = manager.resolveByName("SpiderSize");
+            assert !beans.isEmpty();
+            Bean<?> intModel = beans.iterator().next();
+            assert intModel.getTypes().size() == 2;
+            assert intModel.getTypes().contains(int.class);
+            assert intModel.getTypes().contains(Object.class);
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section={"3.5.1", "2.2"})
+
+   /**
+    * If a field type is primitive or is a Java array type, the set of bean
+    * types contains exactly two types: the field type and java.lang.Object.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = { "producerField", "broken" })
+   @SpecAssertion(section = { "3.5.1", "2.2" })
    public void testApiTypeForArrayTypeReturn() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("getSpiders");
-      Bean<Spider[]> spidersModel = createProducerFieldBean(field, bean);
-      assert spidersModel.getTypes().size() == 2;
-      assert spidersModel.getTypes().contains(Spider[].class);
-      assert spidersModel.getTypes().contains(Object.class);
+      deployBeans(OtherSpiderProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Spider[]>> spidersModels = manager.resolveByType(Spider[].class);
+            assert !spidersModels.isEmpty();
+            Bean<Spider[]> spidersModel = spidersModels.iterator().next();
+            assert spidersModel.getTypes().size() == 2;
+            assert spidersModel.getTypes().contains(Spider[].class);
+            assert spidersModel.getTypes().contains(Object.class);
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+
+   /**
+    * A producer field may also specify scope, name, deployment type,
+    * stereotypes and/or bindings.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField")
+   @SpecAssertion(section = "3.5.2")
    public void testBindingType() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceTameTarantula");
-      Bean<Tarantula> tarantulaModel = createProducerFieldBean(field, bean);
-      assert tarantulaModel.getBindings().size() == 1;
-      assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Tame.class);
+      deployBeans(TameTarantulaProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class, new TameAnnotationLiteral());
+            assert !tarantulaBeans.isEmpty();
+            Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
+            assert tarantulaModel.getBindings().size() == 1;
+            assert tarantulaModel.getBindings().iterator().next().annotationType().equals(Tame.class);
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+
+   /**
+    * A producer field may also specify scope, name, deployment type,
+    * stereotypes and/or bindings.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField")
+   @SpecAssertion(section = "3.5.2")
    public void testScopeType() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceDaddyLongLegs");
-      Bean<DaddyLongLegs> daddyLongLegsModel = createProducerFieldBean(field, bean);
-      assert daddyLongLegsModel.getScopeType().equals(RequestScoped.class);
-      
+      deployBeans(TameTarantulaProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class, new TameAnnotationLiteral());
+            assert !tarantulaBeans.isEmpty();
+            Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
+            assert tarantulaModel.getScopeType().equals(RequestScoped.class);
+         }
+      }.run();
+
       // TODO Inherit scope from returned web bean?
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+
+   /**
+    * A producer field may also specify scope, name, deployment type,
+    * stereotypes and/or bindings.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField")
+   @SpecAssertion(section = "3.5.2")
    public void testDeploymentType() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("getLadybirdSpider");
-      Bean<LadybirdSpider> ladybirdSpiderModel = createProducerFieldBean(field, bean);
-      assert ladybirdSpiderModel.getDeploymentType().equals(Production.class);
+      deployBeans(TameTarantulaProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class, new TameAnnotationLiteral());
+            assert !tarantulaBeans.isEmpty();
+            Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
+            assert tarantulaModel.getDeploymentType().equals(Production.class);
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+
+   /**
+    * A producer field may also specify scope, name, deployment type,
+    * stereotypes and/or bindings.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField")
+   @SpecAssertion(section = "3.5.2")
    public void testNamedField() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceBlackWidow");
-      Bean<BlackWidow> blackWidowSpiderModel = createProducerFieldBean(field, bean);
-      assert blackWidowSpiderModel.getName().equals("blackWidow");
+      deployBeans(BlackWidowProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<?>> beans = manager.resolveByName("blackWidow");
+            assert !beans.isEmpty();
+
+            @SuppressWarnings("unchecked")
+            Bean<BlackWidow> blackWidowModel = (Bean<BlackWidow>) beans.iterator().next();
+            assert blackWidowModel.getName().equals("blackWidow");
+         }
+      }.run();
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section="3.5.2")
+
+   /**
+    * The default name for a producer field is the field name.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = { "producerField", "broken" })
+   @SpecAssertion(section = "3.5.4")
    public void testDefaultNamedField() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceDaddyLongLegs");
-      Bean<DaddyLongLegs> daddyLongLegsSpiderModel = createProducerFieldBean(field, bean);
-      assert daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
+      deployBeans(StaticTarantulaProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class);
+            assert !tarantulaBeans.isEmpty();
+            Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
+            assert tarantulaModel.getName().equals("produceTarantula");
+         }
+      }.run();
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testDisposalFieldNonStatic()
    {
       // TODO Placeholder
       assert false;
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testDisposalFieldFieldDeclaredOnWebBeanImplementationClass()
    {
       // TODO Placeholder
       assert false;
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testDisposalFieldBindingAnnotations()
    {
       // TODO Placeholder
       assert false;
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testDisposalFieldDefaultBindingAnnotations()
    {
       // TODO Placeholder
       assert false;
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testDisposalFieldDoesNotResolveToProducerField()
    {
       // TODO Placeholder
       assert false;
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testDisposalFieldDeclaredOnEnabledBean()
    {
       // TODO Placeholder
       // TODO Move this
-      
+
       assert false;
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testBeanCanDeclareMultipleDisposalFields()
    {
-      // TODO move this 
+      // TODO move this
       // TODO Placeholder
       assert false;
    }
-   
-   @Test(groups={"stub", "disposalField"}) @SpecAssertion(section="3.3.5")
+
+   @Test(groups = { "stub", "disposalField" })
+   @SpecAssertion(section = "3.3.5")
    public void testProducerFieldHasNoMoreThanOneDisposalField()
    {
-      // TODO move this 
+      // TODO move this
       // TODO Placeholder
       assert false;
    }
-   
-   @SuppressWarnings("unchecked")
-   @Test(groups="producerField") @SpecAssertion(section={"2.7.2", "3.5.2", "2.2"})
+
+   /**
+    * A producer field may also specify scope, name, deployment type,
+    * stereotypes and/or bindings.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = "producerField")
+   @SpecAssertion(section = { "2.7.2", "3.5.2", "2.2" })
    public void testStereotype() throws Exception
    {
-      Bean<OtherSpiderProducer> bean = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(bean);
-      Field field = OtherSpiderProducer.class.getField("produceWolfSpider");
-      Bean<WolfSpider> wolfSpiderModel = createProducerFieldBean(field, bean);
- 
-      
-      // TODO reimplement stereotype tests
-      //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().size() == 1;
-      //assert wolfSpiderModel.getMergedStereotypes().getRequiredTypes().contains(Animal.class);
-      
-      assert wolfSpiderModel.getScopeType().equals(RequestScoped.class);
+      deployBeans(StaticTarantulaProducer.class);
+      new RunInDependentContext()
+      {
+         public void execute()
+         {
+            Set<Bean<Tarantula>> tarantulaBeans = manager.resolveByType(Tarantula.class);
+            assert !tarantulaBeans.isEmpty();
+            Bean<Tarantula> tarantulaModel = tarantulaBeans.iterator().next();
+            assert tarantulaModel.getScopeType().equals(RequestScoped.class);
+            assert tarantulaModel.getDeploymentType().equals(Production.class);
+         }
+      }.run();
    }
-   
-   @Test @SpecAssertion(section="4.2")
+
+   @Test(groups = "producerField")
+   @SpecAssertion(section = "4.2")
    public void testNonStaticProducerFieldNotInherited()
    {
       deployBeans(InfertileChicken.class);

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldLifecycleTest.java	2009-01-23 18:44:32 UTC (rev 1208)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/ProducerFieldLifecycleTest.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -1,17 +1,12 @@
 package org.jboss.webbeans.tck.unit.implementation.producer.field;
 
-import java.lang.reflect.Field;
-import java.util.Set;
-
 import javax.webbeans.IllegalProductException;
-import javax.webbeans.manager.Bean;
-
 import org.jboss.webbeans.tck.AbstractTest;
 import org.jboss.webbeans.tck.impl.SpecAssertion;
 import org.jboss.webbeans.tck.impl.SpecVersion;
 import org.testng.annotations.Test;
 
- at SpecVersion("20081206")
+ at SpecVersion("PRD2")
 public class ProducerFieldLifecycleTest extends AbstractTest
 {
 
@@ -22,30 +17,59 @@
     * 
     * • If the producer method is static, the container must access the field
     * value.
-    * 
-    * @throws Exception
     */
    @Test(groups = { "producerField", "broken" })
    @SpecAssertion(section = "5.6")
    public void testProducerStaticFieldBean()
    {
-      deployBeans(OtherSpiderProducer.class, TarantulaConsumer.class);
-      TarantulaConsumer tarantulaConsumer = manager.getInstanceByType(TarantulaConsumer.class);
-      assert tarantulaConsumer.getConsumedTarantula().equals(OtherSpiderProducer.produceTarantula);
+      deployBeans(StaticTarantulaProducer.class, TarantulaConsumer.class);
+      new RunInDependentContext()
+      {
+
+         @Override
+         protected void execute() throws Exception
+         {
+            TarantulaConsumer tarantulaConsumer = manager.getInstanceByType(TarantulaConsumer.class);
+            assert tarantulaConsumer.getConsumedTarantula().equals(StaticTarantulaProducer.produceTarantula);
+         }
+      };
    }
 
+   /**
+    * When the create() method of a Bean object that represents a producer field
+    * is called, the container must access the producer field to obtain the
+    * current value of the field.
+    * 
+    * • Otherwise, if the producer method is non-static, the container must:
+    * 
+    * • obtain the Bean object for the most specialized bean that specializes
+    * the bean which declares the producer field, and then
+    * 
+    * • obtain an instance of the most specialized bean, by calling
+    * Manager.getInstance(), passing the Bean object rep- resenting the bean,
+    * and
+    * 
+    * • access the field value of this instance.
+    * 
+    * The value of the producer field is the new contextual instance to be
+    * returned by Bean.create().
+    * 
+    * @throws Exception
+    */
    @Test(groups = { "producerField", "broken" })
-   @SpecAssertion(section = "5.6")
+   @SpecAssertion(section = "6.8")
    public void testProducerFieldBeanCreate() throws Exception
    {
-      deployBeans(OtherSpiderProducer.class);
-      Set<Bean<OtherSpiderProducer>> beans = manager.resolveByType(OtherSpiderProducer.class);
-      assert beans.size() == 1;
-      Bean<OtherSpiderProducer> spiderProducer = beans.iterator().next();
-      Field method = OtherSpiderProducer.class.getField("produceTarantula");
-      Bean<Tarantula> tarantulaBean = createProducerFieldBean(method, spiderProducer);
-      Tarantula tarantula = tarantulaBean.create();
-      assert tarantula != null;
+      deployBeans(BlackWidowProducer.class, BlackWidowConsumer.class);
+      new RunInDependentContext()
+      {
+         @Override
+         protected void execute() throws Exception
+         {
+            BlackWidowConsumer spiderConsumer = manager.getInstanceByType(BlackWidowConsumer.class);
+            assert spiderConsumer.getInjectedSpider().equals(BlackWidowProducer.blackWidow);
+         }
+      }.run();
    }
 
    @Test(groups = { "stub", "specialization" })
@@ -56,26 +80,48 @@
       assert false;
    }
 
-   @Test(groups = { "producerField", "broken" })
-   @SpecAssertion(section = { "3.5", "5.6", "8.3" })
+   /**
+    * If the producer field contains a null value and the producer field bean
+    * has the scope @Dependent, the create() method re- turns a null value.
+    * 
+    * @throws Exception
+    */
+   @Test(groups = { "producerField" })
+   @SpecAssertion(section = { "3.5", "6.8", "8.3" })
    public void testProducerFieldReturnsNullIsDependent() throws Exception
    {
-      Bean<OtherSpiderProducer> spiderProducer = createSimpleBean(OtherSpiderProducer.class);
-      manager.addBean(spiderProducer);
-      Field method = OtherSpiderProducer.class.getField("getNullSpider");
-      Bean<Spider> spiderBean = createProducerFieldBean(method, spiderProducer);
-      Spider spider = spiderBean.create();
-      assert spider == null;
+      deployBeans(NullSpiderProducer.class, NullSpiderConsumer.class);
+      new RunInDependentContext()
+      {
+         @Override
+         protected void execute() throws Exception
+         {
+            NullSpiderConsumer consumerBean = manager.getInstanceByType(NullSpiderConsumer.class);
+            assert consumerBean.getInjectedSpider() == null;
+         }
+      }.run();
    }
 
-   @Test(groups = "producerField", expectedExceptions = IllegalProductException.class)
-   @SpecAssertion(section = { "3.5", "5.6" })
+   /**
+    * Otherwise, if the producer field contains a null value, and the scope of
+    * the producer method is not @Dependent, the cre- method throws an
+    * IllegalProductException. ate()
+    * 
+    * @throws Exception
+    */
+   @Test(groups = { "producerField", "broken" }, expectedExceptions = IllegalProductException.class)
+   @SpecAssertion(section = { "3.5", "6.8" })
    public void testProducerFieldReturnsNullIsNotDependent() throws Exception
    {
-      Bean<OtherSpiderProducer_Broken> spiderProducer = createSimpleBean(OtherSpiderProducer_Broken.class);
-      manager.addBean(spiderProducer);
-      Field method = OtherSpiderProducer_Broken.class.getField("getRequestScopedSpider");
-      createProducerFieldBean(method, spiderProducer).create();
+      deployBeans(NullSpiderProducer_Broken.class, NullSpiderConsumer.class);
+      new RunInDependentContext()
+      {
+         @Override
+         protected void execute() throws Exception
+         {
+            manager.getInstanceByType(NullSpiderConsumer.class);
+         }
+      }.run();
    }
 
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/Spider.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/Spider.java	2009-01-23 18:44:32 UTC (rev 1208)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/Spider.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -3,7 +3,9 @@
 class Spider implements Animal
 {
 
-   public final void layEggs()
+   private static final long serialVersionUID = 1L;
+
+   public void layEggs()
    {
       
    }

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderAsAnimalProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderAsAnimalProducer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderAsAnimalProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Produces;
+
+public class SpiderAsAnimalProducer
+{
+   @Produces
+   public Animal makeASpider = new WolfSpider();
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderAsAnimalProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderProducerWildCardType_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderProducerWildCardType_Broken.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderProducerWildCardType_Broken.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Produces;
+
+public class SpiderProducerWildCardType_Broken
+{
+   @Produces public FunnelWeaver<?> getAnotherFunnelWeaver = new FunnelWeaver<Object>();
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderProducerWildCardType_Broken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderStereotype.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderStereotype.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import static java.lang.annotation.ElementType.FIELD;
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.Stereotype;
+
+/**
+ * Test stereotype used to change the scope type and deployment type
+ * of another bean, in particular a producer field bean.
+ * 
+ * @author David Allen
+ *
+ */
+ at Stereotype(requiredTypes=Spider.class)
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at RequestScoped
+ at Production
+public @interface SpiderStereotype
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/SpiderStereotype.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/StaticTarantulaProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/StaticTarantulaProducer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/StaticTarantulaProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Produces;
+
+public class StaticTarantulaProducer
+{
+   @Produces @SpiderStereotype public static Tarantula produceTarantula = new Tarantula();
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/StaticTarantulaProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameAnnotationLiteral.java (from rev 1198, tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/event/TameAnnotationLiteral.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameAnnotationLiteral.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameAnnotationLiteral.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.AnnotationLiteral;
+
+class TameAnnotationLiteral extends AnnotationLiteral<Tame> implements Tame
+{
+
+}

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameTarantulaProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameTarantulaProducer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameTarantulaProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Produces;
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+
+public class TameTarantulaProducer
+{
+   @Produces @Tame @RequestScoped @Production public Tarantula produceTarantula = new DefangedTarantula();
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TameTarantulaProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaConsumer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaConsumer.java	2009-01-23 18:44:32 UTC (rev 1208)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaConsumer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -21,7 +21,7 @@
 
 /**
  * This bean contains an injection point for a Tarantula that must be provided
- * by the container via a producer field.
+ * by the container via a (static) producer field.
  * 
  * @author David Allen
  * 

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaProducer.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaProducer.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.webbeans.Produces;
+
+ at AnotherDeploymentType
+public class TarantulaProducer
+{
+   @Produces public Tarantula produceTarantula = new DefangedTarantula();
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/TarantulaProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpider.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpider.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpider.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.ejb.Local;
+import javax.webbeans.Produces;
+
+ at Local
+public interface VibratingSpider
+{
+   @Produces public Integer numberOfEyes = 5;
+   
+   @Produces public Integer numberOfLegs = 8;
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpider.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpiderImpl_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpiderImpl_Broken.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpiderImpl_Broken.java	2009-01-23 19:55:53 UTC (rev 1209)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.tck.unit.implementation.producer.field;
+
+import javax.ejb.Stateless;
+import javax.webbeans.Produces;
+
+ at Stateless
+public class VibratingSpiderImpl_Broken implements VibratingSpider
+{
+   @Produces public Integer numberOfEggs = 5000;
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/producer/field/VibratingSpiderImpl_Broken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the weld-commits mailing list