[webbeans-commits] Webbeans SVN: r149 - in ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test: util and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sat Oct 25 14:49:56 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-10-25 14:49:56 -0400 (Sat, 25 Oct 2008)
New Revision: 149

Modified:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
Log:
Add utility classes for creating simple models and simple beans

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -2,14 +2,12 @@
 
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import javax.webbeans.Production;
 import javax.webbeans.Standard;
 
 import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedType;
 import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.StereotypeModel;
 import org.jboss.webbeans.test.annotations.AnimalStereotype;
@@ -52,10 +50,5 @@
       container.getModelManager().addStereotype(new StereotypeModel<RiverFishStereotype>(new SimpleAnnotatedType<RiverFishStereotype>(RiverFishStereotype.class)));
       container.getModelManager().addStereotype(new StereotypeModel<RequestScopedAnimalStereotype>(new SimpleAnnotatedType<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class)));
    }
-   
-   protected static <T> AnnotatedType<T> getEmptyAnnotatedItem(Class<T> type)
-   {
-      return new SimpleAnnotatedType<T>(type, new HashMap<Class<? extends Annotation>, Annotation>());
-   }
 
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,8 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.createSimpleModel;
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
 import java.util.Map;
@@ -25,7 +28,7 @@
    @Test @SpecAssertion(section={"2.3.3", "2.3.1"}) 
    public void testDefaultBindingTypeDeclaredInJava()
    {
-      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), getEmptyAnnotatedItem(Order.class), manager);
+      SimpleComponentModel<Order> order = createSimpleModel(Order.class, manager);
       assert order.getBindingTypes().size() == 1;
       order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
    }
@@ -58,7 +61,7 @@
    @Test @SpecAssertion(section="2.3.3")
    public void testBindingTypesDeclaredInJava()
    {
-      SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new SimpleAnnotatedType(Cat.class), getEmptyAnnotatedItem(Cat.class), manager);
+      SimpleComponentModel<Cat> cat = createSimpleModel(Cat.class, manager);
       assert cat.getBindingTypes().size() == 1;
       assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
    }

Modified: 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-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import javax.webbeans.Current;
 
 import org.jboss.webbeans.injectable.SimpleConstructor;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import javax.webbeans.ContextNotActiveException;
 import javax.webbeans.RequestScoped;
 import javax.webbeans.manager.Bean;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
 import java.util.Map;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import javax.webbeans.AmbiguousDependencyException;
 import javax.webbeans.UnsatisfiedDependencyException;
 import javax.webbeans.manager.Bean;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import javax.webbeans.AmbiguousDependencyException;
 import javax.webbeans.AnnotationLiteral;
 import javax.webbeans.UnproxyableDependencyException;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import javax.webbeans.manager.Bean;
 
 import org.jboss.webbeans.BeanImpl;
@@ -13,7 +15,6 @@
 import org.jboss.webbeans.test.components.Sole;
 import org.jboss.webbeans.test.components.Tuna;
 import org.testng.annotations.Test;
-
 public class NameBasedResolutionTest extends AbstractTest
 {
 

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import java.lang.reflect.Method;
 
 import javax.webbeans.Current;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
 import java.util.Map;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,6 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
 
 import java.lang.annotation.Annotation;
 import java.util.HashMap;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,5 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
+
 import java.util.HashSet;
 import java.util.Set;
 

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java	2008-10-25 18:38:53 UTC (rev 148)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java	2008-10-25 18:49:56 UTC (rev 149)
@@ -1,7 +1,32 @@
 package org.jboss.webbeans.test.util;
 
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
 
+import org.jboss.webbeans.BeanImpl;
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.SimpleComponentModel;
+
+
 public class Util
 {
+   public static <T> BeanImpl<T> createSimpleWebBean(Class<T> clazz, ManagerImpl manager)
+   {
+      return new BeanImpl<T>(createSimpleModel(clazz, manager), manager);
+   }
    
+   public static <T> SimpleComponentModel<T> createSimpleModel(Class<T> clazz, ManagerImpl manager)
+   {
+      return new SimpleComponentModel<T>(new SimpleAnnotatedType<T>(clazz), getEmptyAnnotatedItem(clazz), manager);
+   }
+   
+   public static <T> AnnotatedType<T> getEmptyAnnotatedItem(Class<T> type)
+   {
+      return new SimpleAnnotatedType<T>(type, new HashMap<Class<? extends Annotation>, Annotation>());
+   }
+   
+   
+   
 }




More information about the weld-commits mailing list