[weld-commits] Weld SVN: r3926 - in cdi-tck/trunk: impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb and 9 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sun Oct 11 12:34:01 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-10-11 12:34:00 -0400 (Sun, 11 Oct 2009)
New Revision: 3926

Added:
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryObserver.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryTest.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/Cockatoo.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cat.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Chicken.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ChickenHutch.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cow.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cowshed.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Elephant.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ElephantLocal.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanObserver.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanTest.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessSessionBeanTest.java
   cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/
   cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/javax.enterprise.inject.spi.Extension
   cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/processBean/
   cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/processBean/javax.enterprise.inject.spi.Extension
Removed:
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBeanLocal.java
Modified:
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/Farm.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/House.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBean.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java
   cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
   cdi-tck/trunk/pom.xml
Log:
add some process bean tests, improve others

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/DependentContextEjbTest.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -44,10 +44,12 @@
       Bean<HouseLocal> bean = getBeans(HouseLocal.class).iterator().next();
       CreationalContext<HouseLocal> creationalContext = getCurrentManager().createCreationalContext(bean);
       HouseLocal instance = bean.create(creationalContext);
-      instance.open();
+      instance.open().getTable().lay();
       Room.destroyed = false;
       Table.destroyed = false;
+      House.destroyed = false;
       bean.destroy(instance, creationalContext);
+      assert House.destroyed;
       assert Room.destroyed;
       assert Table.destroyed;
    }
@@ -62,7 +64,9 @@
       FarmLocal farm = farmBean.create(creationalContext);
       Horse.destroyed = false;
       Stable.destroyed = false;
+      Farm.destroyed = false;
       farmBean.destroy(farm, creationalContext);
+      assert Farm.destroyed;
       assert Horse.destroyed;
       assert Stable.destroyed;
     }

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/Farm.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/Farm.java	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/Farm.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -1,5 +1,6 @@
 package org.jboss.jsr299.tck.tests.context.dependent.ejb;
 
+import javax.annotation.PreDestroy;
 import javax.ejb.Stateful;
 import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
@@ -9,8 +10,17 @@
 public class Farm implements FarmLocal
 {
    
+   public static boolean destroyed;
+   
    @Inject Stable stable;
    
-   public void open() {};
+   public void open() {}
    
+   
+   @PreDestroy
+   public void preDestroy()
+   {
+      Farm.destroyed = true;
+   }
+   
 }

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/House.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/House.java	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/ejb/House.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -1,5 +1,6 @@
 package org.jboss.jsr299.tck.tests.context.dependent.ejb;
 
+import javax.annotation.PreDestroy;
 import javax.ejb.Stateful;
 import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
@@ -8,11 +9,19 @@
 public class House implements HouseLocal
 {
    
+   public static boolean destroyed;
+   
    @Inject RoomLocal room;
    
    public RoomLocal open() 
    {
       return room;
-   };
+   }
    
+   @PreDestroy
+    public void preDestroy()
+   {
+      House.destroyed = true;
+   }
+   
 }

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryObserver.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryObserver.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryObserver.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,102 @@
+package org.jboss.jsr299.tck.tests.extensions.afterBeanDiscovery;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.jboss.jsr299.tck.literals.DefaultLiteral;
+
+public class AfterBeanDiscoveryObserver implements Extension
+{
+   
+   private static boolean processBeanFiredForCockatooBean;
+   
+   public static boolean isProcessBeanFiredForCockatooBean()
+   {
+      return processBeanFiredForCockatooBean;
+   }
+   
+   public void observeProcessBean(@Observes ProcessBean<Cockatoo> event)
+   {
+      AfterBeanDiscoveryObserver.processBeanFiredForCockatooBean = true;
+      assert event.getBean().getName().equals("cockatoo");
+   }
+   
+   public void addABean(@Observes AfterBeanDiscovery afterBeanDiscovery)
+   {
+      afterBeanDiscovery.addBean(new Bean<Cockatoo>()
+      {
+         
+         private final Set<Annotation> qualifiers = new HashSet<Annotation>(Arrays.asList(new DefaultLiteral()));
+         private final Set<Type> types = new HashSet<Type>(Arrays.<Type>asList(Cockatoo.class));
+
+         public Class<?> getBeanClass()
+         {
+            return Cockatoo.class;
+         }
+
+         public Set<InjectionPoint> getInjectionPoints()
+         {
+            return Collections.emptySet();
+         }
+
+         public String getName()
+         {
+            return "cockatoo";
+         }
+
+         public Set<Annotation> getQualifiers()
+         {
+            return qualifiers;
+         }
+
+         public Class<? extends Annotation> getScope()
+         {
+            return Dependent.class;
+         }
+
+         public Set<Class<? extends Annotation>> getStereotypes()
+         {
+            return Collections.emptySet();
+         }
+
+         public Set<Type> getTypes()
+         {
+            return types;
+         }
+
+         public boolean isAlternative()
+         {
+            return false;
+         }
+
+         public boolean isNullable()
+         {
+            return true;
+         }
+
+         public Cockatoo create(CreationalContext<Cockatoo> creationalContext)
+         {
+            return new Cockatoo("Billy");
+         }
+
+         public void destroy(Cockatoo instance, CreationalContext<Cockatoo> creationalContext)
+         {
+            // No-op
+         }
+      });
+   }
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryObserver.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryTest.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryTest.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,38 @@
+package org.jboss.jsr299.tck.tests.extensions.afterBeanDiscovery;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
+import org.testng.annotations.Test;
+
+ at Artifact
+ at IntegrationTest
+ at Extension("javax.enterprise.inject.spi.Extension")
+ at SpecVersion(spec="cdi", version="PFD2")
+public class AfterBeanDiscoveryTest extends AbstractJSR299Test
+{
+   
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.2", id="db")
+   })
+   public void testBeanIsAdded()
+   {
+      assert getBeans(Cockatoo.class).size() == 1;
+      assert getInstanceByType(Cockatoo.class).getName().equals("Billy");
+   }
+   
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.2", id="da")
+   })
+   public void testProcessBeanIsFired()
+   {
+      assert AfterBeanDiscoveryObserver.isProcessBeanFiredForCockatooBean();
+   }
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/AfterBeanDiscoveryTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/Cockatoo.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/Cockatoo.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/Cockatoo.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.extensions.afterBeanDiscovery;
+
+public class Cockatoo
+{
+   
+   private final String name;
+   
+   public Cockatoo(String name)
+   {
+      this.name = name;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/Cockatoo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cat.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cat.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cat.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+
+class Cat
+{
+
+   
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cat.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Chicken.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Chicken.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Chicken.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+public class Chicken
+{
+   
+   public Chicken(String name)
+   {
+   }
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Chicken.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ChickenHutch.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ChickenHutch.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ChickenHutch.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+import javax.enterprise.inject.Produces;
+
+public class ChickenHutch
+{
+   @Produces
+   private Chicken chicken;
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ChickenHutch.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cow.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cow.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cow.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+public class Cow
+{
+   
+   public Cow(String name)
+   {
+   }
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cow.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cowshed.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cowshed.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cowshed.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+public class Cowshed
+{
+   @Produces
+   public Cow getDaisy()
+   {
+      return new Cow("Daisy");
+   }
+   
+   public void disposeOfDaisy(@Disposes Cow daisy)
+   {
+      
+   }
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Cowshed.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Elephant.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Elephant.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Elephant.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+import javax.ejb.Stateless;
+
+ at Stateless(name="Rosie")
+public class Elephant implements ElephantLocal
+{
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/Elephant.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ElephantLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ElephantLocal.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ElephantLocal.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+import javax.ejb.Local;
+
+ at Local
+public interface ElephantLocal
+{
+
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ElephantLocal.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanObserver.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanObserver.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanObserver.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,106 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+
+public class ProcessBeanObserver implements Extension
+{
+   private static ProcessManagedBean<Cat> catProcessManagedBean;
+   private static int catProcessBeanCount;
+   
+   private static ProcessProducerMethod<Cowshed, Cow> cowProcessProducerMethod;
+   private static int cowShedProcessBeanCount;
+   
+   private static ProcessSessionBean<Elephant> elephantProcessSessionBean;
+   private static int elephantProcessBeanCount;
+   private static ProcessProducerField<ChickenHutch, Chicken> chickenProcessProducerField;
+   private static int chickenHutchProcessBeanCount;
+
+   public void observeCatManagedBean(@Observes ProcessManagedBean<Cat> event)
+   {
+      ProcessBeanObserver.catProcessManagedBean = event;
+      ProcessBeanObserver.catProcessBeanCount++;
+   }
+   
+   public void observeCatBean(@Observes ProcessBean<Cat> event)
+   {
+      ProcessBeanObserver.catProcessBeanCount++;
+   }
+   
+   public void observeElephantSessionBean(@Observes ProcessSessionBean<Elephant> event)
+   {
+      ProcessBeanObserver.elephantProcessSessionBean = event;
+      ProcessBeanObserver.elephantProcessBeanCount++;
+   }
+   
+   public void observeElephantBean(@Observes ProcessBean<Elephant> event)
+   {
+      ProcessBeanObserver.elephantProcessBeanCount++;
+   }
+   
+   public void observeCowProcessProducerMethod(@Observes ProcessProducerMethod<Cowshed, Cow> event)
+   {
+      ProcessBeanObserver.cowProcessProducerMethod = event;
+   }
+   
+   public void observeCowProccesBean(@Observes ProcessBean<Cowshed> event)
+   {
+      ProcessBeanObserver.cowShedProcessBeanCount++;
+   }
+   
+   public void observeChickenProcessProducerField(@Observes ProcessProducerField<ChickenHutch, Chicken> event)
+   {
+      ProcessBeanObserver.chickenProcessProducerField = event;
+   }
+   
+   public void observeChickenProccesBean(@Observes ProcessBean<ChickenHutch> event)
+   {
+      ProcessBeanObserver.chickenHutchProcessBeanCount++;
+   }
+   
+   public static ProcessManagedBean<Cat> getCatProcessManagedBean()
+   {
+      return catProcessManagedBean;
+   }
+   
+   public static ProcessProducerMethod<Cowshed, Cow> getCowProcessProducerMethod()
+   {
+      return cowProcessProducerMethod;
+   }
+   
+   public static ProcessSessionBean<Elephant> getElephantProcessSessionBean()
+   {
+      return elephantProcessSessionBean;
+   }
+   
+   public static int getCatProcessBeanCount()
+   {
+      return catProcessBeanCount;
+   }
+   
+   public static int getCowShedProcessBeanCount()
+   {
+      return cowShedProcessBeanCount;
+   }
+   
+   public static int getElephantProcessBeanCount()
+   {
+      return elephantProcessBeanCount;
+   }
+   
+   public static int getChickenHutchProcessBeanCount()
+   {
+      return chickenHutchProcessBeanCount;
+   }
+   
+   public static ProcessProducerField<ChickenHutch, Chicken> getChickenProcessProducerField()
+   {
+      return chickenProcessProducerField;
+   }
+   
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanObserver.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanTest.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanTest.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,89 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
+import org.testng.annotations.Test;
+
+/**
+ * Producer extension tests.
+ * 
+ * @author David Allen
+ *
+ */
+ at Artifact
+ at Extension("javax.enterprise.inject.spi.Extension")
+// Must be an integration test as it needs a resource copied to a folder
+ at IntegrationTest
+ at SpecVersion(spec="cdi", version="PFD2")
+public class ProcessBeanTest extends AbstractJSR299Test
+{
+   
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.8", id = "ba"),
+      @SpecAssertion(section = "11.5.8", id = "eda"),
+      @SpecAssertion(section = "11.5.8", id = "efa"),
+      @SpecAssertion(section = "11.5.8", id = "fa"),
+      @SpecAssertion(section = "11.5.8", id = "l")
+   })
+   public void testProcessBeanEvent()
+   {
+      assert ProcessBeanObserver.getCatProcessManagedBean().getBean().getBeanClass().equals(Cat.class);
+      assert ProcessBeanObserver.getCatProcessBeanCount() == 2;
+      assert ProcessBeanObserver.getCatProcessManagedBean().getAnnotated() instanceof AnnotatedType<?>;
+      assert ProcessBeanObserver.getCatProcessManagedBean().getAnnotatedBeanClass().getBaseType().equals(Cat.class);
+   }
+   
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.8", id = "eaa"),
+      @SpecAssertion(section = "11.5.8", id = "edc"),
+      @SpecAssertion(section = "11.5.8", id = "efc"),
+      @SpecAssertion(section = "11.5.8", id = "fc"),
+      @SpecAssertion(section = "11.5.8", id = "i"),
+      @SpecAssertion(section = "11.5.8", id = "j")
+   })
+   @Test
+   public void testProcessProducerMethodEvent()
+   {
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getBean().getTypes().contains(Cow.class);
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getBean().getBeanClass().equals(Cowshed.class);
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getAnnotatedProducerMethod().getBaseType().equals(Cow.class);
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getAnnotatedProducerMethod().getDeclaringType().getBaseType().equals(Cowshed.class);
+      assert ProcessBeanObserver.getCowShedProcessBeanCount() == 2;
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getAnnotated() instanceof AnnotatedMethod<?>;
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getAnnotatedProducerMethod().getJavaMember().getName().equals("getDaisy");
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getAnnotatedProducerMethod().getJavaMember().getDeclaringClass().equals(Cowshed.class);
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getAnnotatedDisposedParameter().getDeclaringCallable().getJavaMember().getName().equals("disposeOfDaisy");
+      assert ProcessBeanObserver.getCowProcessProducerMethod().getAnnotatedDisposedParameter().getDeclaringCallable().getJavaMember().getDeclaringClass().equals(Cowshed.class);
+   }
+   
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.8", id = "eb"),
+      @SpecAssertion(section = "11.5.8", id = "edd"),
+      @SpecAssertion(section = "11.5.8", id = "efd"),
+      @SpecAssertion(section = "11.5.8", id = "fd"),
+      @SpecAssertion(section = "11.5.8", id = "n")
+   })
+   @Test
+   public void testProcessProducerFieldEvent()
+   {
+      assert ProcessBeanObserver.getChickenProcessProducerField().getBean().getTypes().contains(Chicken.class);
+      assert ProcessBeanObserver.getChickenProcessProducerField().getBean().getBeanClass().equals(ChickenHutch.class);
+      assert ProcessBeanObserver.getChickenProcessProducerField().getAnnotatedProducerField().getBaseType().equals(Chicken.class);
+      assert ProcessBeanObserver.getChickenProcessProducerField().getAnnotatedProducerField().getDeclaringType().getBaseType().equals(ChickenHutch.class);
+      assert ProcessBeanObserver.getChickenHutchProcessBeanCount() == 2;
+      assert ProcessBeanObserver.getChickenProcessProducerField().getAnnotated() instanceof AnnotatedField<?>;
+      assert ProcessBeanObserver.getChickenProcessProducerField().getAnnotatedProducerField().getJavaMember().getName().equals("chicken");
+      assert ProcessBeanObserver.getChickenProcessProducerField().getAnnotatedProducerField().getJavaMember().getDeclaringClass().equals(ChickenHutch.class);
+   }
+   
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessBeanTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessSessionBeanTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessSessionBeanTest.java	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessSessionBeanTest.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1,54 @@
+package org.jboss.jsr299.tck.tests.extensions.processBean;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.SessionBeanType;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
+import org.testng.annotations.Test;
+
+/**
+ * Producer extension tests.
+ * 
+ * @author David Allen
+ *
+ */
+ at Artifact
+ at Extension("javax.enterprise.inject.spi.Extension")
+// Must be an integration test as it needs a resource copied to a folder
+ at IntegrationTest
+ at Packaging(PackagingType.EAR)
+ at SpecVersion(spec="cdi", version="PFD2")
+public class ProcessSessionBeanTest extends AbstractJSR299Test
+{
+   
+   @Test
+   @SpecAssertions({
+      @SpecAssertion(section = "11.5.8", id = "c"),
+      @SpecAssertion(section = "11.5.8", id = "edb"),
+      @SpecAssertion(section = "11.5.8", id = "efb"),
+      @SpecAssertion(section = "11.5.8", id = "fb"),
+      @SpecAssertion(section = "11.5.8", id = "hb"),
+      @SpecAssertion(section = "11.5.8", id = "hc"),
+      @SpecAssertion(section = "11.5.8", id = "m"),
+      @SpecAssertion(section = "11.5.8", id = "k")
+   })
+   public void testProcessSessionBeanEvent()
+   {
+      assert ProcessBeanObserver.getElephantProcessSessionBean().getBean().getBeanClass().equals(Elephant.class);
+      assert ProcessBeanObserver.getElephantProcessBeanCount() == 2;
+      assert ProcessBeanObserver.getElephantProcessSessionBean().getEjbName().equals("Rosie");
+      assert ProcessBeanObserver.getElephantProcessSessionBean().getSessionBeanType().equals(SessionBeanType.STATELESS);
+      assert ProcessBeanObserver.getElephantProcessSessionBean().getAnnotated() instanceof AnnotatedType<?>;
+      assert ProcessBeanObserver.getElephantProcessSessionBean().getAnnotatedSessionBeanClass().getBaseType().equals(Elephant.class);
+      assert ProcessBeanObserver.getElephantProcessSessionBean().getAnnotatedBeanClass().getBaseType().equals(Elephant.class);
+   }
+   
+}


Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/processBean/ProcessSessionBeanTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -187,8 +187,8 @@
    @Test
    @SpecAssertions({
       @SpecAssertion(section = "11.2", id = "i"),
-      @SpecAssertion(section = "11.5.6", id = "ba"),
-      @SpecAssertion(section = "12.3", id = "ba")
+      @SpecAssertion(section = "12.3", id = "ba"),
+      @SpecAssertion(section = "11.5.6", id = "aaa")
    })
    public void testInjectionTargetInject()
    {

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBean.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBean.java	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBean.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -1,9 +1,8 @@
 package org.jboss.jsr299.tck.tests.implementation.simple.definition;
 
-import javax.ejb.Stateless;
+import javax.ejb.EnterpriseBean;
 
- at Stateless
-class MockEnterpriseBean implements MockEnterpriseBeanLocal
+class MockEnterpriseBean implements EnterpriseBean
 {
 
 	/**

Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBeanLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBeanLocal.java	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/MockEnterpriseBeanLocal.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -1,9 +0,0 @@
-package org.jboss.jsr299.tck.tests.implementation.simple.definition;
-
-import javax.ejb.Local;
-
- at Local
-interface MockEnterpriseBeanLocal
-{
-
-}

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java	2009-10-11 16:34:00 UTC (rev 3926)
@@ -7,10 +7,13 @@
 import org.jboss.test.audit.annotations.SpecAssertions;
 import org.jboss.test.audit.annotations.SpecVersion;
 import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
 import org.testng.annotations.Test;
 
 @Artifact
 @SpecVersion(spec="cdi", version="PFD2")
+ at Packaging(PackagingType.EAR)
 public class SimpleBeanDefinitionTest extends AbstractJSR299Test
 {
 
@@ -46,7 +49,8 @@
       assert getBeans(Car.class).size() == 0;
    }
 
-   @Test
+   @Test(groups = "broken")
+   // TODO The bean will be discovered, just not as a managed bean. This test is doesn't check that *at all*
    @SpecAssertion(section="3.1.1", id="f")
    public void testClassesImplementingEnterpriseBeanInterfaceNotDiscoveredAsSimpleBean()
    {

Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/afterBeanDiscovery/javax.enterprise.inject.spi.Extension	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.extensions.afterBeanDiscovery.AfterBeanDiscoveryObserver
\ No newline at end of file

Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/processBean/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/processBean/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/processBean/javax.enterprise.inject.spi.Extension	2009-10-11 16:34:00 UTC (rev 3926)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.extensions.processBean.ProcessBeanObserver

Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml	2009-10-11 16:34:00 UTC (rev 3926)
@@ -2700,15 +2700,16 @@
     </assertion>
 
     <assertion id="d">
-    <text>When a context is destroyed, all mapped instances belonging to that context are destroyed by passing them to the |Contextual.destroy()| method.</text>
+      <text>When a context is destroyed, all mapped instances belonging to that context are destroyed by passing them to the |Contextual.destroy()| method.</text>
     </assertion>
 
     <assertion id="e">
       <text>Contexts with normal scopes must obey the following rule: Suppose beans A, B and Z all have normal scopes. Suppose A has an injection point x, and B has an injection point y. Suppose further that both x and y resolve to bean Z according to the typesafe resolution algorithm. If a is the current instance of A, and b is the current instance of B, then both a.x and b.y refer to the same instance of Z. This instance is the current instance of Z.</text>
     </assertion>
     
-    <assertion id="ea">
+    <assertion id="ea" testable="false">
       <text>All normal scopes must be explicitly declared |@NormalScope|, to indicate to the container that a client proxy is required.</text>
+      <note>A statement of intent</note>
     </assertion>
 
     <assertion id="fa" testable="false">
@@ -5616,8 +5617,9 @@
   </section>
 
   <section id="11.5.8" title="ProcessBean event">
-    <assertion id="aa">
-    <text>The container must fire an event for each bean it discovers, before registering the |Bean| object.  The event object in the package |javax.enterprise.inject.spi| depends upon what kind of bean was discovered.</text>
+    <assertion id="aa" testable="false">
+      <text>The container must fire an event for each bean it discovers, before registering the |Bean| object.  The event object in the package |javax.enterprise.inject.spi| depends upon what kind of bean was discovered.</text>
+      <note>Tested below</note>
     </assertion>
 
     <assertion id="ba">
@@ -5640,23 +5642,54 @@
       <text>Resources are considered to be producer fields.</text>
     </assertion>
     
-    <assertion id="ed">
+    <group>
       <text>The interface |javax.enterprise.inject.spi.ProcessBean| is a supertype of all these event types.</text>
-    </assertion>
+      <assertion id="eda">
+         <text>Test |ProcessManagedBean|</text>
+      </assertion>
+      <assertion id="edb">
+         <text>Test |ProcessSessionBean|</text>
+      </assertion>
+      <assertion id="edc">
+         <text>Test |ProcessProducerMethod|</text>
+      </assertion>
+      <assertion id="edd">
+         <text>Test |ProcessProducerField|</text>
+      </assertion>
+    </group>
    
     <group>
       <text>|getAnnotated()| returns the |AnnotatedType| representing the bean class, the |AnnotatedMethod| representing the producer method, or the |AnnotatedField| representing the producer field.</text>
       <assertion id="efa">
-        <text>Test producer method</text>
+         <text>Test |ProcessManagedBean|</text>
       </assertion>
       <assertion id="efb">
-        <text>Test producer field</text>
+         <text>Test |ProcessSessionBean|</text>
       </assertion>
-    </group> 
+      <assertion id="efc">
+         <text>Test |ProcessProducerMethod|</text>
+      </assertion>
+      <assertion id="efd">
+         <text>Test |ProcessProducerField|</text>
+      </assertion>
+    </group>
 
-    <assertion id="fa">
+    <group>
       <text>|getBean()| returns the |Bean| object that is about to be registered.  The |Bean| may implement |Interceptor| or |Decorator|.</text>
-    </assertion>
+      <assertion id="fa">
+         <text>Test |ProcessManagedBean|</text>
+      </assertion>
+      <assertion id="fb">
+         <text>Test |ProcessSessionBean|</text>
+      </assertion>
+      <assertion id="fc">
+         <text>Test |ProcessProducerMethod|</text>
+      </assertion>
+      <assertion id="fd">
+         <text>Test |ProcessProducerField|</text>
+      </assertion>
+    </group>
+    
 
     <assertion id="h">
       <text>|addDefinitionError()| registers a definition error with the container, causing the container to abort deployment after bean discovery is complete.</text>
@@ -5673,6 +5706,33 @@
     <assertion id="hd">
       <text>If any observer method of a |ProcessBean| event throws an exception, the exception is treated as a definition error by the container.</text>
     </assertion>
+    
+    <assertion id="i" implied="true">
+      <text>Check the |getAnnotatedProducerMethod()|</text>
+    </assertion>
+    
+    <assertion id="j" implied="true">
+      <text>Check the |getAnnotatedDisposesParameter()|</text>
+    </assertion>
+    
+    <assertion id="k" implied="true">
+      <text>Check the |getAnnotatedSessionBeanClass()|</text>
+    </assertion>
+    
+    <group>
+      <text>Check the |getAnnotatedBeanClass()|</text>
+      <assertion id="l" implied="true">
+         <text>Check for managed bean</text>
+      </assertion>
+      <assertion id="m" implied="true">
+         <text>Check for session bean</text>
+      </assertion>
+    </group>
+    
+    <assertion id="n" implied="true">
+      <text>Check the |getAnnotatedProducerField()|</text>
+    </assertion>
+    
   </section>
 
   <section id="11.5.9" title="ProcessObserverMethod event">

Modified: cdi-tck/trunk/pom.xml
===================================================================
--- cdi-tck/trunk/pom.xml	2009-10-11 13:47:46 UTC (rev 3925)
+++ cdi-tck/trunk/pom.xml	2009-10-11 16:34:00 UTC (rev 3926)
@@ -365,11 +365,21 @@
                   </execution>
                </executions>
             </plugin>
-               <plugin>
-                  <groupId>org.apache.maven.plugins</groupId>
-                  <artifactId>maven-release-plugin</artifactId>
-                  <version>2.0-beta-9</version>
-               </plugin>
+            <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-release-plugin</artifactId>
+               <version>2.0-beta-9</version>
+            </plugin>
+            <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-eclipse-plugin</artifactId>
+               <configuration>
+                  <classpathContainers>
+                     <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+                  </classpathContainers>
+               </configuration>
+            </plugin>
+
          </plugins>
       </pluginManagement>
    </build>



More information about the weld-commits mailing list