[webbeans-commits] Webbeans SVN: r849 - in tck/trunk: impl/src/main/java/org/jboss/webbeans/tck/impl/test and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Jan 9 07:26:50 EST 2009


Author: shane.bryzak at jboss.com
Date: 2009-01-09 07:26:50 -0500 (Fri, 09 Jan 2009)
New Revision: 849

Modified:
   tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/AbstractTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/BindingTypeTest.java
Log:
tck support for producer methods

Modified: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java	2009-01-09 12:17:03 UTC (rev 848)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/Beans.java	2009-01-09 12:26:50 UTC (rev 849)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.tck.api;
 
+import java.lang.reflect.Method;
+
 import javax.webbeans.manager.Bean;
 import javax.webbeans.manager.Manager;
 
@@ -11,5 +13,5 @@
 public interface Beans
 {
    <T> Bean<T> createSimpleBean(Class<T> clazz, Manager manager);
-   
+   <T> Bean<T> getProducerMethodBean(Method method, Bean<T> clazz, Manager manager);
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/AbstractTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/AbstractTest.java	2009-01-09 12:17:03 UTC (rev 848)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/AbstractTest.java	2009-01-09 12:26:50 UTC (rev 849)
@@ -5,6 +5,7 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.lang.reflect.Method;
 import java.util.Arrays;
 
 import javax.webbeans.Production;
@@ -34,6 +35,11 @@
    {
       return TckUtils.getBeans().createSimpleBean(beanClass, manager);
    }
+   
+   public <T> Bean<?> getProducerMethodBean(Method method, Bean<?> producerBean)
+   {
+      return TckUtils.getBeans().getProducerMethodBean(method, producerBean, manager);
+   }
 
    /*
    protected <T> AbstractClassBean<T> registerBean(Class<T> clazz)

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/BindingTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/BindingTypeTest.java	2009-01-09 12:17:03 UTC (rev 848)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/test/BindingTypeTest.java	2009-01-09 12:26:50 UTC (rev 849)
@@ -20,7 +20,6 @@
 import org.jboss.webbeans.tck.impl.test.beans.Tarantula;
 import org.jboss.webbeans.tck.impl.test.beans.Tuna;
 
-import org.jboss.webbeans.bean.ProducerMethodBean;
 import org.jboss.webbeans.binding.CurrentBinding;
 
 import org.testng.annotations.Test;
@@ -127,7 +126,7 @@
       Bean<SpiderProducer> spiderProducer = getSimpleBean(SpiderProducer.class);
       manager.addBean(spiderProducer);
       Method method = SpiderProducer.class.getMethod("produceTameTarantula");
-      manager.addBean(ProducerMethodBean.of(method, spiderProducer, manager));
+      manager.addBean(getProducerMethodBean(method, spiderProducer));
       Barn barn = getSimpleBean(Barn.class).create();
       assert barn.petSpider != null;
       assert barn.petSpider instanceof DefangedTarantula;
@@ -145,15 +144,16 @@
       assert false;
    }
    
+   @SuppressWarnings("unchecked")
    @Test(groups={"injection", "producerMethod"})
    public void testMethodWithBindingAnnotationsOnParametersAreInjected() throws Exception
    {
-      SimpleBean<SpiderProducer> spiderProducer = SimpleBean.of(SpiderProducer.class, manager);
+      Bean<SpiderProducer> spiderProducer = getSimpleBean(SpiderProducer.class);
       manager.addBean(spiderProducer);
       Method method = SpiderProducer.class.getMethod("produceTameTarantula");
-      manager.addBean(ProducerMethodBean.of(method, spiderProducer, manager));
+      manager.addBean(getProducerMethodBean(method, spiderProducer));
       method = SpiderProducer.class.getMethod("produceSpiderFromInjection", Tarantula.class);
-      ProducerMethodBean<Spider> spiderBean = ProducerMethodBean.of(method, spiderProducer, manager);
+      Bean<Spider> spiderBean = (Bean<Spider>) getProducerMethodBean(method, spiderProducer);
       Spider spider = spiderBean.create();
       assert spider != null;
       assert spider instanceof DefangedTarantula;




More information about the weld-commits mailing list