[webbeans-commits] Webbeans SVN: r164 - in ri/trunk/webbeans-ri: src/main/java/org/jboss/webbeans/model/bean and 2 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Oct 26 09:33:12 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-10-26 09:33:12 -0400 (Sun, 26 Oct 2008)
New Revision: 164

Removed:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goat.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goose.java
Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Donkey.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Duck.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Sheep.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Turkey.java
   ri/trunk/webbeans-ri/testng.xml
Log:
Update tests for section 3.2 to PDR

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -143,7 +143,7 @@
    {
       if (Reflections.isAbstract(getType()))
       {
-         throw new RuntimeException("Web Bean implementation class " + type + " cannot be declared abstract");
+         throw new DefinitionException("Web Bean implementation class " + type + " cannot be declared abstract");
       }
    }
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -5,6 +5,7 @@
 import java.util.logging.Logger;
 
 import javax.webbeans.BindingType;
+import javax.webbeans.DefinitionException;
 import javax.webbeans.Initializer;
 
 import org.jboss.webbeans.ManagerImpl;
@@ -59,7 +60,7 @@
    {
       if (type.isMemberClass())
       {
-         throw new RuntimeException("Simple Web Bean " + type + " cannot be an inner class");
+         throw new DefinitionException("Simple Web Bean " + type + " cannot be an inner class");
       }
    }
    

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -1,155 +0,0 @@
-package org.jboss.webbeans.test;
-
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
-
-import javax.webbeans.Current;
-
-import org.jboss.webbeans.injectable.SimpleConstructor;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.bean.SimpleBeanModel;
-import org.jboss.webbeans.test.annotations.Synchronous;
-import org.jboss.webbeans.test.beans.Chicken;
-import org.jboss.webbeans.test.beans.Donkey;
-import org.jboss.webbeans.test.beans.Duck;
-import org.jboss.webbeans.test.beans.Goat;
-import org.jboss.webbeans.test.beans.Goose;
-import org.jboss.webbeans.test.beans.Order;
-import org.jboss.webbeans.test.beans.Sheep;
-import org.jboss.webbeans.test.beans.Turkey;
-import org.jboss.webbeans.util.Reflections;
-import org.testng.annotations.Test;
-
- at SpecVersion("20080925")
-public class ConstructorModelTest extends AbstractTest
-{
-   
-   @Test
-   public void testImplicitConstructor()
-   {
-      SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
-      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
-      assert constructor.getParameters().size() == 0;
-   }
-   
-   @SuppressWarnings("unchecked")
-   @Test
-   public void testSingleConstructor()
-   {
-      SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor();
-      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Donkey.class);
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 1;
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
-      assert constructor.getParameters().size() == 1;
-      assert constructor.getParameters().get(0).getType().equals(String.class);
-      assert constructor.getParameters().get(0).getBindingTypes().size() == 1;
-      assert Reflections.annotationSetMatches(constructor.getParameters().get(0).getBindingTypes(), Current.class);
-   }
-   
-   @SuppressWarnings("unchecked")
-   @Test
-   public void testInitializerAnnotatedConstructor()
-   {
-      SimpleConstructor<Sheep> constructor = new SimpleBeanModel<Sheep>(new SimpleAnnotatedType<Sheep>(Sheep.class), getEmptyAnnotatedType(Sheep.class), manager).getConstructor();
-      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Sheep.class);
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 2;
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[1].equals(Double.class);
-      assert constructor.getParameters().size() == 2;
-      assert constructor.getParameters().get(0).getType().equals(String.class);
-      assert constructor.getParameters().get(1).getType().equals(Double.class);
-      assert constructor.getParameters().get(0).getBindingTypes().size() == 1;
-      assert Reflections.annotationSetMatches(constructor.getParameters().get(0).getBindingTypes(), Current.class);
-      assert constructor.getParameters().get(1).getBindingTypes().size() == 1;
-      assert Reflections.annotationSetMatches(constructor.getParameters().get(1).getBindingTypes(), Current.class);
-   }
-   
-   @SuppressWarnings("unchecked")
-   @Test
-   public void testBindingTypeAnnotatedConstructor()
-   {
-      SimpleConstructor<Duck> constructor = new SimpleBeanModel<Duck>(new SimpleAnnotatedType<Duck>(Duck.class), getEmptyAnnotatedType(Duck.class), manager).getConstructor();
-      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Duck.class);
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 2;
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[1].equals(Integer.class);
-      assert constructor.getParameters().size() == 2;
-      assert constructor.getParameters().get(0).getType().equals(String.class);
-      assert constructor.getParameters().get(1).getType().equals(Integer.class);
-      assert constructor.getParameters().get(0).getBindingTypes().size() == 1;
-      assert Reflections.annotationSetMatches(constructor.getParameters().get(0).getBindingTypes(), Current.class);
-      assert constructor.getParameters().get(1).getBindingTypes().size() == 1;
-      assert Reflections.annotationSetMatches(constructor.getParameters().get(1).getBindingTypes(), Synchronous.class);
-   }
-   
-   @Test
-   public void testTooManyInitializerAnnotatedConstructor()
-   {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
-      
-   }
-   
-   @Test
-   public void testTooManyConstructors()
-   {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<Turkey>(new SimpleAnnotatedType<Turkey>(Turkey.class), getEmptyAnnotatedType(Turkey.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
-      
-   }
-   
-   @Test
-   public void testTooManyBindingTypeAnnotatedConstructor()
-   {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<Goat>(new SimpleAnnotatedType<Goat>(Goat.class), getEmptyAnnotatedType(Goat.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
-      
-   }
-   
-   @Test
-   public void testBindingTypeAndInitializerAnnotatedConstructor()
-   {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<Goose>(new SimpleAnnotatedType<Goose>(Goose.class), getEmptyAnnotatedType(Goose.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
-      
-   }
-   
-   @Test @SpecAssertion(section="2.7.2")
-   public void testStereotypeOnConstructor()
-   {
-	   assert false;
-   }
-   
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -87,7 +87,7 @@
       assert cod.getName().equals("whitefish");
    }
    
-   @Test @SpecAssertion(section="2.6.3")
+   @Test @SpecAssertion(section={"2.6.3", "3.2.7"})
    public void testDefaultNamed()
    {
       SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedType(Haddock.class), manager);

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -5,21 +5,21 @@
 public class ProducerExpressionBeanLifecycleTest
 {
 
-   @Test(groups={"beanLifecycle", "producerExpression"}) @SpecAssertion(section="3.4")
+   @Test(groups={"beanLifecycle", "producerMethod"}) @SpecAssertion(section="3.4")
    public void testNonDependentProducerExpressionThatReturnsNull()
    {
       // TODO Placeholder
       assert false;
    }
    
-   @Test(groups={"beanLifecycle", "producerExpression"}) @SpecAssertion(section="3.4")
+   @Test(groups={"beanLifecycle", "producerMethod"}) @SpecAssertion(section="3.4")
    public void testDependentProducerExpressionThatReturnsNull()
    {
       // TODO Placeholder
       assert false;
    }
    
-   @Test(groups={"beanLifecycle", "producerExpression"}) @SpecAssertion(section="3.4")
+   @Test(groups={"beanLifecycle", "producerMethod"}) @SpecAssertion(section="3.4")
    public void testProducerExpressionHasValidRuntimeApiType()
    {
       // TODO Placeholder

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -5,25 +5,25 @@
 public class ProducerExpressionBeanModelTest extends AbstractTest
 {
    
-   @Test(groups="producerExpression") @SpecAssertion(section="3.4")
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
    public void testApiTypes()
    {
       assert false;
    }
    
-   @Test(groups="producerExpression") @SpecAssertion(section="3.4")
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
    public void testFinalProducerExpression()
    {
       assert false;
    }
    
-   @Test(groups="producerExpression") @SpecAssertion(section="3.4")
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
    public void testFinalDependentProducerExpression()
    {
       assert false;
    }
    
-   @Test(groups="producerExpression") @SpecAssertion(section="3.4.2")
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
    public void testProducerExpressionCannotHaveDefaultName()
    {
       assert false;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -1,116 +1,295 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.createSimpleWebBean;
 import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
 
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.Iterator;
 
-import javax.webbeans.Dependent;
+import javax.webbeans.DefinitionException;
+import javax.webbeans.NonexistentConstructorException;
+import javax.webbeans.manager.Bean;
 
-import org.jboss.webbeans.bindings.DependentAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.injectable.InjectableParameter;
+import org.jboss.webbeans.injectable.SimpleConstructor;
 import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.bean.SimpleBeanModel;
+import org.jboss.webbeans.test.beans.Animal;
+import org.jboss.webbeans.test.beans.Chicken;
 import org.jboss.webbeans.test.beans.Cow;
-import org.jboss.webbeans.test.beans.Horse;
-import org.jboss.webbeans.test.beans.broken.Pig;
+import org.jboss.webbeans.test.beans.DeadlyAnimal;
+import org.jboss.webbeans.test.beans.DeadlySpider;
+import org.jboss.webbeans.test.beans.Donkey;
+import org.jboss.webbeans.test.beans.Duck;
+import org.jboss.webbeans.test.beans.Order;
+import org.jboss.webbeans.test.beans.Sheep;
+import org.jboss.webbeans.test.beans.Spider;
+import org.jboss.webbeans.test.beans.Tarantula;
+import org.jboss.webbeans.test.beans.Turkey;
 import org.jboss.webbeans.test.beans.broken.OuterBean.InnerBean;
+import org.jboss.webbeans.test.bindings.SynchronousAnnotationLiteral;
 import org.testng.annotations.Test;
 
- at SpecVersion("20080925")
+ at SpecVersion("PDR")
 public class SimpleBeanModelTest extends AbstractTest
 {   
    
-   // **** TESTS FOR STEREOTYPES **** //
+   //*** BEAN CLASS CHECKS ****//
    
+   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
+   public void testAbstractClassDeclaredInJavaIsNotAllowed()
+   {
+      new SimpleBeanModel<Cow>(new SimpleAnnotatedType<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
+   }
    
+   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
+   public void testNonStaticInnerClassDeclaredInJavaIsNotAllowed()
+   {
+      new SimpleBeanModel<InnerBean>(new SimpleAnnotatedType<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
+   }
    
-   //*** BEAN CLASS CHECKS ****//
+   @Test @SpecAssertion(section="3.2")
+   public void testStaticInnerClassDeclaredInJavaAllowed()
+   {
+      assert false;
+   }
    
-   @Test
-   public void testAbstractClassIsNotAllowed()
+   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
+   public void testParameterizedClassDeclaredInJavaIsNotAllowed()
    {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<Cow>(new SimpleAnnotatedType<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      
    }
    
-   @Test
-   public void testInnerClassIsNotAllowed()
+   @Test(expectedExceptions=DefinitionException.class, groups={"interceptors", "decorators"}) @SpecAssertion(section="3.2")
+   public void testClassCannotBeInterceptorAndDecorator()
    {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<InnerBean>(new SimpleAnnotatedType<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      
    }
    
-   @Test
-   public void testFinalClassMustBeDependentScoped()
+   @Test(groups="deployment") @SpecAssertion(section="3.2")
+   public void testOnlyOneWebBeanPerAnnotatedClass()
    {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<Horse>(new SimpleAnnotatedType<Horse>(Horse.class), getEmptyAnnotatedType(Horse.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
       
-      Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
-      annotations.put(Dependent.class, new DependentAnnotationLiteral());
-      AnnotatedType<Horse> annotatedItem = new SimpleAnnotatedType<Horse>(Horse.class, annotations);
-      try
-      {
-         new SimpleBeanModel<Horse>(new SimpleAnnotatedType<Horse>(Horse.class), annotatedItem, manager);
-      }
-      catch (Exception e) 
-      {
-         assert false;
-      }
    }
    
-   @Test
-   public void testClassWithFinalMethodMustBeDependentScoped()
+   @Test @SpecAssertion(section="3.2.2")
+   public void testApiTypes()
    {
-      boolean exception = false;
-      try
-      {
-         new SimpleBeanModel<Pig>(new SimpleAnnotatedType<Pig>(Pig.class), getEmptyAnnotatedType(Pig.class), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      Bean<Tarantula> bean = createSimpleWebBean(Tarantula.class, manager);
+      assert bean.getTypes().size() == 6;
+      assert bean.getTypes().contains(Tarantula.class);
+      assert bean.getTypes().contains(Spider.class);
+      assert bean.getTypes().contains(Animal.class);
+      assert bean.getTypes().contains(Object.class);
+      assert bean.getTypes().contains(DeadlySpider.class);
+      assert bean.getTypes().contains(DeadlyAnimal.class);
+   }
+   
+   @Test(groups="producerMethod") @SpecAssertion(section="3.2.4")
+   public void testBeanDeclaredInXmlIgnoresProducerMethodDeclaredInJava()
+   {
+      assert false;
+   }
+   
+   @Test(groups="disposalMethod") @SpecAssertion(section="3.2.4")
+   public void testBeanDeclaredInXmlIgnoresDisposalMethodDeclaredInJava()
+   {
+      assert false;
+   }
+   
+   @Test(groups="eventbus") @SpecAssertion(section="3.2.4")
+   public void testBeanDeclaredInXmlIgnoresObserverMethodDeclaredInJava()
+   {
+      assert false;
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.4")
+   public void testAbstractClassDeclaredInXmlIsNotAllowed()
+   {
+      assert false;
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.4")
+   public void testNonStaticInnerClassDeclaredInXmlIsNotAllowed()
+   {
+      assert false;
+   }
+   
+   @Test @SpecAssertion(section="3.2.4")
+   public void testStaticInnerClassDeclaredInXmlAllowed()
+   {
+      assert false;
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.4")
+   public void testParameterizedClassDeclaredInXmlIsNotAllowed()
+   {
+      assert false;
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class, groups={"interceptors"}) @SpecAssertion(section="3.2.4")
+   public void testClassHasInterceptorInJavaMustHaveInterceptorInXml()
+   {
+      assert false;
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class, groups={"interceptors"}) @SpecAssertion(section="3.2.4")
+   public void testClassHasDecoratorInJavaMustHaveDecoratorInXml()
+   {
+      assert false;
+   }
+   
+   @Test @SpecAssertion(section="3.2.5.1")
+   public void testInitializerAnnotatedConstructor()
+   {
+      SimpleConstructor<Sheep> constructor = new SimpleBeanModel<Sheep>(new SimpleAnnotatedType<Sheep>(Sheep.class), getEmptyAnnotatedType(Sheep.class), manager).getConstructor();
+      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Sheep.class);
+      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 2;
+      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
+      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[1].equals(Double.class);
+      assert constructor.getParameters().size() == 2;
+      assert constructor.getParameters().get(0).getType().equals(String.class);
+      assert constructor.getParameters().get(1).getType().equals(Double.class);
+      assert constructor.getParameters().get(0).getBindingTypes().size() == 1;
+      assert constructor.getParameters().get(0).getBindingTypes().contains(new CurrentAnnotationLiteral());
+      assert constructor.getParameters().get(1).getBindingTypes().size() == 1;
+      assert constructor.getParameters().get(1).getBindingTypes().contains(new CurrentAnnotationLiteral());
+   }
+   
+   @Test @SpecAssertion(section="3.2.5.1")
+   public void testImplicitConstructorUsed()
+   {
+      SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
+      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
+      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
+      assert constructor.getParameters().size() == 0;
+   }
+   
+   @Test @SpecAssertion(section="3.2.5.1")
+   public void testEmptyConstructorUsed()
+   {
+      SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor();      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
+      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
+      assert constructor.getParameters().size() == 0;
+   }
+   
+   @Test @SpecAssertion(section="3.2.5.1")
+   public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor()
+   {
+      SimpleConstructor<Turkey> constructor = new SimpleBeanModel<Turkey>(new SimpleAnnotatedType<Turkey>(Turkey.class), getEmptyAnnotatedType(Turkey.class), manager).getConstructor();
+      assert constructor.getParameters().size() == 2;
+      Iterator<InjectableParameter<?>> it = constructor.getParameters().iterator();
+      assert it.next().getType().equals(String.class);
+      assert it.next().getType().equals(Integer.class);
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.5.1")
+   public void testTooManyInitializerAnnotatedConstructor()
+   {
+      new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class, groups="disposalMethod") @SpecAssertion(section="3.2.5.1")
+   public void testConstructorHasDisposesParameter()
+   {
+      new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
+   }
+   
+   @Test(expectedExceptions=DefinitionException.class, groups="eventBus") @SpecAssertion(section="3.2.5.1")
+   public void testConstructorHasObservesParameter()
+   {
+      new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
+   }
+   
+   @Test @SpecAssertion(section="3.2.5.2")
+   public void testImplicitConstructorDeclaredInXmlUsed()
+   {
+      SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
+      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
+      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
+      assert constructor.getParameters().size() == 0;
+      assert false;
+   }
+   
+   @Test @SpecAssertion(section="3.2.5.2")
+   public void testEmptyConstructorDeclaredInXmlUsed()
+   {
+      SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor();      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
+      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
+      assert constructor.getParameters().size() == 0;
+      assert false;
+   }
+   
+   @Test(expectedExceptions=NonexistentConstructorException.class) @SpecAssertion(section="3.2.5.2")
+   public void testConstructorDeclaredInXmlDoesNotExist()
+   {
       
-      Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
-      annotations.put(Dependent.class, new DependentAnnotationLiteral());
-      AnnotatedType<Pig> annotatedItem = new SimpleAnnotatedType<Pig>(Pig.class, annotations);
-      try
-      {
-         new SimpleBeanModel<Pig>(new SimpleAnnotatedType<Pig>(Pig.class), annotatedItem, manager);
-      }
-      catch (Exception e) 
-      {
-         assert false;
-      }
    }
    
+   @Test @SpecAssertion(section="3.2.5.2")
+   public void testConstructorDeclaredInXmlIgnoresBindingTypesDeclaredInJava()
+   {
+      
+   }
    
+   @Test @SpecAssertion(section="3.2.5.3")
+   public void testBindingTypeAnnotatedConstructor()
+   {
+      SimpleConstructor<Duck> constructor = new SimpleBeanModel<Duck>(new SimpleAnnotatedType<Duck>(Duck.class), getEmptyAnnotatedType(Duck.class), manager).getConstructor();
+      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Duck.class);
+      assert constructor.getParameters().size() == 2;
+      Iterator<InjectableParameter<?>> it = constructor.getParameters().iterator();
+      assert it.next().getType().equals(String.class);
+      assert it.next().getType().equals(Integer.class);
+      assert constructor.getParameters().size() == 2;
+      assert constructor.getParameters().get(0).getType().equals(String.class);
+      assert constructor.getParameters().get(1).getType().equals(Integer.class);
+      assert constructor.getParameters().get(0).getBindingTypes().size() == 1;
+      assert constructor.getParameters().get(0).getBindingTypes().contains(new CurrentAnnotationLiteral());
+      assert constructor.getParameters().get(1).getBindingTypes().size() == 1;
+      assert constructor.getParameters().get(1).getBindingTypes().contains(new SynchronousAnnotationLiteral());
+   }
+   
+   @Test(groups="specialization") @SpecAssertion(section="3.2.6")
+   public void testSpecializedClassInheritsBindingTypes()
+   {
+      assert false;
+   }
+   
+   @Test(groups="specialization") @SpecAssertion(section="3.2.6")
+   public void testSpecializedClassInheritsName()
+   {
+      assert false;
+   }
+   
+   @Test(groups="specialization") @SpecAssertion(section="3.2.6")
+   public void testLessSpecializedClassNotInstantiated()
+   {
+      assert false;
+   }
+   
+   @Test(groups="specialization",expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.6")
+   public void testSpecializedClassMustExtendAnotherWebBean()
+   {
+      assert false;
+   }
+   
+   @Test(groups="specialization") @SpecAssertion(section="3.2.6")
+   public void testSpecializedClassDeclaredInXmlInheritsBindingTypes()
+   {
+      assert false;
+   }
+   
+   @Test(groups="specialization") @SpecAssertion(section="3.2.6")
+   public void testSpecializedClassDeclaredInXmlInheritsName()
+   {
+      assert false;
+   }
+   
+   @Test(groups="specialization") @SpecAssertion(section="3.2.6")
+   public void testLessSpecializedClassDeclaredInXmlNotInstantiated()
+   {
+      assert false;
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Donkey.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Donkey.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Donkey.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -6,6 +6,11 @@
 public class Donkey
 {
    
+   public Donkey()
+   {
+      
+   }
+   
    public Donkey(String foo)
    {
       

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Duck.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Duck.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Duck.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -1,5 +1,6 @@
 package org.jboss.webbeans.test.beans;
 
+import javax.webbeans.Initializer;
 import javax.webbeans.Production;
 
 import org.jboss.webbeans.test.annotations.Synchronous;
@@ -7,12 +8,8 @@
 @Production
 public class Duck
 {
-
-   public Duck(String foo)
-   {
-      // TODO Auto-generated constructor stub
-   }
    
+   @Initializer
    public Duck(String foo, @Synchronous Integer bar)
    {
       

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goat.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goat.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goat.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -1,23 +0,0 @@
-package org.jboss.webbeans.test.beans;
-
-import javax.webbeans.Production;
-
-import org.jboss.webbeans.test.annotations.Asynchronous;
-import org.jboss.webbeans.test.annotations.Synchronous;
-
- at Production
-public class Goat
-{
-   
-   public Goat(@Synchronous String foo)
-   {
-      // TODO Auto-generated constructor stub
-   }
-   
-   public Goat(@Asynchronous String foo, String bar)
-   {
-      // TODO Auto-generated constructor stub
-   }
-   
-
-}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goose.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goose.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Goose.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -1,24 +0,0 @@
-package org.jboss.webbeans.test.beans;
-
-import javax.webbeans.Initializer;
-import javax.webbeans.Production;
-
-import org.jboss.webbeans.test.annotations.Synchronous;
-
- at Production
-public class Goose
-{
-   
-   public Goose(@Synchronous String foo)
-   {
-      // TODO Auto-generated constructor stub
-   }
-   
-   @Initializer
-   public Goose(String foo, String bar)
-   {
-      // TODO Auto-generated constructor stub
-   }
-   
-
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Sheep.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Sheep.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Sheep.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -6,13 +6,7 @@
 @Production
 public class Sheep
 {
-
    
-   public Sheep(String foo)
-   {
-      
-   }
-   
    @Initializer
    public Sheep(String foo, Double bar)
    {

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Turkey.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Turkey.java	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Turkey.java	2008-10-26 13:33:12 UTC (rev 164)
@@ -1,16 +1,18 @@
 package org.jboss.webbeans.test.beans;
 
+import javax.webbeans.Initializer;
 import javax.webbeans.Production;
 
 @Production
 public class Turkey
 {
    
-   public Turkey(String foo)
+   public Turkey()
    {
       
    }
    
+   @Initializer
    public Turkey(String foo, Integer bar)
    {
       

Modified: ri/trunk/webbeans-ri/testng.xml
===================================================================
--- ri/trunk/webbeans-ri/testng.xml	2008-10-26 12:34:06 UTC (rev 163)
+++ ri/trunk/webbeans-ri/testng.xml	2008-10-26 13:33:12 UTC (rev 164)
@@ -9,7 +9,7 @@
             <exclude name="beanLifecycle" />
             <exclude name="deployment" />
             <exclude name="disposalMethod" />
-            <exclude name="producerExpression" />
+            <exclude name="producerMethod" />
             <exclude name="eventbus" />
             <exclude name="injection" />
             <exclude name="contexts" />




More information about the weld-commits mailing list