[webbeans-commits] Webbeans SVN: r1045 - ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test and 12 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Sat Jan 17 14:46:43 EST 2009
Author: pete.muir at jboss.org
Date: 2009-01-17 14:46:43 -0500 (Sat, 17 Jan 2009)
New Revision: 1045
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Animal.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/AnotherDeploymentType.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BoostrapTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlyAnimal.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlySpider.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DefangedTarantula.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Elephant.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Hound.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserver.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesApplicationContext.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesRequestContext.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/LadybirdSpider.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Panther.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Salmon.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ScottishFish.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/SeaBass.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Sole.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Spider.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tame.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tarantula.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/TarantulaProducer.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tiger.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tuna.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Whitefish.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/context/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Animal.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Order.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/AnotherDeploymentType.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Asynchronous.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Tuna.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Animal.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Antelope.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewSimpleBeanTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Order.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedEnterpriseBean.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedSimpleBean.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Animal.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/AnotherDeploymentType.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Chunky.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Cod.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Expensive.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Farmer.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/FishFarm.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Haddock.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Salmon.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ScottishFish.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/SeaBass.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Sole.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Tuna.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Whitefish.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/invalid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/contexts/valid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/invalid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ejb/valid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/integration/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/invalid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/valid/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/resource/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/BoostrapTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ClassAnnotatedItemTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewEnterpriseBeanTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewSimpleBeanTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/PassivatingContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ResolutionByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/StereotypesTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java
ri/trunk/webbeans-ri/unit-tests.xml
Log:
move unit tests to own packages with beans
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -30,6 +30,8 @@
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.binding.CurrentBinding;
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
import org.jboss.webbeans.test.beans.BeanWithInjectionPointMetadata;
import org.jboss.webbeans.test.beans.ConstructorInjectionPointBean;
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/BoostrapTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/BoostrapTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/BoostrapTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,288 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.bean.AbstractBean;
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.ProducerMethodBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.beans.Elephant;
-import org.jboss.webbeans.test.beans.InitializedObserver;
-import org.jboss.webbeans.test.beans.InitializedObserverWhichUsesApplicationContext;
-import org.jboss.webbeans.test.beans.InitializedObserverWhichUsesRequestContext;
-import org.jboss.webbeans.test.beans.LadybirdSpider;
-import org.jboss.webbeans.test.beans.Panther;
-import org.jboss.webbeans.test.beans.Salmon;
-import org.jboss.webbeans.test.beans.SeaBass;
-import org.jboss.webbeans.test.beans.Sole;
-import org.jboss.webbeans.test.beans.Tarantula;
-import org.jboss.webbeans.test.beans.TarantulaProducer;
-import org.jboss.webbeans.test.beans.Tiger;
-import org.jboss.webbeans.test.beans.Tuna;
-import org.jboss.webbeans.test.ejb.valid.Hound;
-import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
-import org.testng.annotations.Test;
-
-public class BoostrapTest extends AbstractTest
-{
- @Test(groups="bootstrap")
- public void testSingleSimpleBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Tuna.class));
- webBeansBootstrap.boot();
- List<Bean<?>> beans = manager.getBeans();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(Tuna.class);
- }
-
- @Test(groups="bootstrap")
- public void testSingleEnterpriseBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class));
- webBeansBootstrap.boot();
- List<Bean<?>> beans = manager.getBeans();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(Hound.class);
- }
-
- @Test(groups="bootstrap")
- public void testMultipleSimpleBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Tuna.class, Salmon.class, SeaBass.class, Sole.class));
- webBeansBootstrap.boot();
- List<Bean<?>> beans = manager.getBeans();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(Tuna.class);
- assert classes.containsKey(Salmon.class);
- assert classes.containsKey(SeaBass.class);
- assert classes.containsKey(Sole.class);
-
- assert classes.get(Tuna.class) instanceof SimpleBean;
- assert classes.get(Salmon.class) instanceof SimpleBean;
- assert classes.get(SeaBass.class) instanceof SimpleBean;
- assert classes.get(Sole.class) instanceof SimpleBean;
- }
-
- @Test(groups="bootstrap")
- public void testProducerMethodBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TarantulaProducer.class));
- webBeansBootstrap.boot();
- List<Bean<?>> beans = manager.getBeans();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(TarantulaProducer.class);
- assert classes.containsKey(Tarantula.class);
-
- assert classes.get(TarantulaProducer.class) instanceof SimpleBean;
- assert classes.get(Tarantula.class) instanceof ProducerMethodBean;
- }
-
- @Test(groups="bootstrap")
- public void testMultipleEnterpriseBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class));
- webBeansBootstrap.boot();
- List<Bean<?>> beans = manager.getBeans();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(Hound.class);
- assert classes.containsKey(Elephant.class);
- assert classes.containsKey(Panther.class);
- assert classes.containsKey(Tiger.class);
-
- assert classes.get(Hound.class) instanceof EnterpriseBean;
- assert classes.get(Elephant.class) instanceof EnterpriseBean;
- assert classes.get(Panther.class) instanceof EnterpriseBean;
- assert classes.get(Tiger.class) instanceof EnterpriseBean;
- }
-
- @Test(groups="bootstrap")
- public void testMultipleEnterpriseAndSimpleBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
- webBeansBootstrap.boot();
- List<Bean<?>> beans = manager.getBeans();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : beans)
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(Hound.class);
- assert classes.containsKey(Elephant.class);
- assert classes.containsKey(Panther.class);
- assert classes.containsKey(Tiger.class);
- assert classes.containsKey(Tuna.class);
- assert classes.containsKey(Salmon.class);
- assert classes.containsKey(SeaBass.class);
- assert classes.containsKey(Sole.class);
-
- assert classes.get(Hound.class) instanceof EnterpriseBean;
- assert classes.get(Elephant.class) instanceof EnterpriseBean;
- assert classes.get(Panther.class) instanceof EnterpriseBean;
- assert classes.get(Tiger.class) instanceof EnterpriseBean;
- assert classes.get(Tuna.class) instanceof SimpleBean;
- assert classes.get(Salmon.class) instanceof SimpleBean;
- assert classes.get(SeaBass.class) instanceof SimpleBean;
- assert classes.get(Sole.class) instanceof SimpleBean;
- }
-
- @Test(groups="bootstrap")
- public void testRegisterProducerMethodBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TarantulaProducer.class));
- webBeansBootstrap.boot();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : manager.getBeans())
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(TarantulaProducer.class);
- assert classes.containsKey(Tarantula.class);
-
-
- assert classes.get(TarantulaProducer.class) instanceof SimpleBean;
- assert classes.get(Tarantula.class) instanceof ProducerMethodBean;
- }
-
- @Test(groups="bootstrap")
- public void testRegisterMultipleEnterpriseAndSimpleBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
- webBeansBootstrap.boot();
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : manager.getBeans())
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(Hound.class);
- assert classes.containsKey(Elephant.class);
- assert classes.containsKey(Panther.class);
- assert classes.containsKey(Tiger.class);
- assert classes.containsKey(Tuna.class);
- assert classes.containsKey(Salmon.class);
- assert classes.containsKey(SeaBass.class);
- assert classes.containsKey(Sole.class);
-
- assert classes.get(Hound.class) instanceof EnterpriseBean;
- assert classes.get(Elephant.class) instanceof EnterpriseBean;
- assert classes.get(Panther.class) instanceof EnterpriseBean;
- assert classes.get(Tiger.class) instanceof EnterpriseBean;
- assert classes.get(Tuna.class) instanceof SimpleBean;
- assert classes.get(Salmon.class) instanceof SimpleBean;
- assert classes.get(SeaBass.class) instanceof SimpleBean;
- assert classes.get(Sole.class) instanceof SimpleBean;
- }
-
- @Test(groups="bootstrap", expectedExceptions=IllegalStateException.class)
- public void testDiscoverFails()
- {
- webBeansBootstrap.setWebBeanDiscovery(null);
- webBeansBootstrap.boot();
- }
-
- @Test(groups="bootstrap")
- public void testDiscover()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
- webBeansBootstrap.boot();
-
- Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
- for (Bean<?> bean : manager.getBeans())
- {
- if (bean instanceof AbstractBean)
- {
- classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
- }
- }
- assert classes.containsKey(Hound.class);
- assert classes.containsKey(Elephant.class);
- assert classes.containsKey(Panther.class);
- assert classes.containsKey(Tiger.class);
- assert classes.containsKey(Tuna.class);
- assert classes.containsKey(Salmon.class);
- assert classes.containsKey(SeaBass.class);
- assert classes.containsKey(Sole.class);
-
- assert classes.get(Hound.class) instanceof EnterpriseBean;
- assert classes.get(Elephant.class) instanceof EnterpriseBean;
- assert classes.get(Panther.class) instanceof EnterpriseBean;
- assert classes.get(Tiger.class) instanceof EnterpriseBean;
- assert classes.get(Tuna.class) instanceof SimpleBean;
- assert classes.get(Salmon.class) instanceof SimpleBean;
- assert classes.get(SeaBass.class) instanceof SimpleBean;
- assert classes.get(Sole.class) instanceof SimpleBean;
- }
-
- @Test(groups="bootstrap")
- public void testInitializedEvent()
- {
- assert !InitializedObserver.observered;
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(InitializedObserver.class));
- webBeansBootstrap.boot();
-
- assert InitializedObserver.observered;
- }
-
- @Test(groups="bootstrap")
- public void testRequestContextActiveDuringInitializtionEvent()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(InitializedObserverWhichUsesRequestContext.class, Tuna.class));
- webBeansBootstrap.boot();
- }
-
- @Test(groups={"bootstrap", "broken"})
- public void testApplicationContextActiveDuringInitializtionEvent()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(InitializedObserverWhichUsesApplicationContext.class, LadybirdSpider.class));
- webBeansBootstrap.boot();
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ClassAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ClassAnnotatedItemTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ClassAnnotatedItemTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,50 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import java.lang.annotation.Annotation;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.webbeans.DeploymentType;
-import javax.webbeans.Production;
-import javax.webbeans.Stereotype;
-
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
-import org.jboss.webbeans.test.beans.Antelope;
-import org.jboss.webbeans.test.beans.Order;
-import org.testng.annotations.Test;
-
-public class ClassAnnotatedItemTest
-{
-
- @Test
- public void testDeclaredAnnotations()
- {
- AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
- assert annotatedElement.getAnnotations().size() == 1;
- assert annotatedElement.getAnnotation(Production.class) != null;
- assert annotatedElement.getType().equals(Order.class);
- }
-
- @Test
- public void testMetaAnnotations()
- {
- AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
- Set<Annotation> annotations = annotatedElement.getMetaAnnotations(DeploymentType.class);
- assert annotations.size() == 1;
- Iterator<Annotation> it = annotations.iterator();
- Annotation production = it.next();
- assert Production.class.equals(production.annotationType());
- }
-
- @Test
- public void testEmpty()
- {
- AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
- assert annotatedElement.getAnnotation(Stereotype.class) == null;
- assert annotatedElement.getMetaAnnotations(Stereotype.class).size() == 0;
- AnnotatedClass<Antelope> classWithNoAnnotations = new AnnotatedClassImpl<Antelope>(Antelope.class);
- assert classWithNoAnnotations.getAnnotations().size() == 0;
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/DeferredEventNotificationTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/DeferredEventNotificationTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,82 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import java.util.Arrays;
-
-import javax.webbeans.Observes;
-import javax.webbeans.Standard;
-
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
-import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
-import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
-import org.jboss.webbeans.test.annotations.Asynchronous;
-import org.jboss.webbeans.test.beans.Tuna;
-import org.testng.annotations.Test;
-
-/**
- * Unit tests for the deferred event notification object used to delay
- * notification till the end of a transaction.
- *
- * @author David Allen
- *
- */
-public class DeferredEventNotificationTest extends AbstractTest
-{
-
- public class Event
- {
- // Simple class used for testing
- }
-
- @Override
- protected void addStandardDeploymentTypesForTests()
- {
- manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, AnotherDeploymentType.class));
- }
-
- public class AnObserver
- {
- protected boolean notified = false;
-
- public void observe(@Observes @Asynchronous Event e)
- {
- // An observer method
- this.notified = true;
- }
- }
-
- /**
- * Test method for
- * {@link org.jboss.webbeans.event.DeferredEventNotification#beforeCompletion()}
- * .
- */
- @Test(groups={"deferredEvent", "broken"})
- public final void testBeforeCompletion() throws Exception
- {
- // When the transaction is committed, the beforeCompletion() method is
- // invoked which in turn invokes the observer. Here the mock observer
- // is used to keep track of the event being fired.
- SimpleBean<Tuna> tuna;
- AnnotatedMethod<Object> om;
-
-
- // Create an observer with known binding types
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
- // TODO This should test a real class
- tuna = SimpleBean.of(Tuna.class, manager);
- om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), new AnnotatedClassImpl<AnObserver>(AnObserver.class));
-
- AnObserver observerInstance = new AnObserver();
- // TODO Fix this Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);
- //((MockObserverImpl<Event>) observer).setInstance(observerInstance);
- Event event = new Event();
- //DeferredEventNotification<Event> deferredNotification = new DeferredEventNotification<Event>(event, observer);
- //deferredNotification.beforeCompletion();
- assert observerInstance.notified;
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewEnterpriseBeanTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewEnterpriseBeanTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewEnterpriseBeanTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,66 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-import org.jboss.webbeans.bean.EnterpriseBean;
-import org.jboss.webbeans.bean.NewEnterpriseBean;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.newbean.valid.WrappedEnterpriseBean;
-import org.jboss.webbeans.test.newbean.valid.WrappedSimpleBean;
-import org.jboss.webbeans.util.Proxies.TypeInfo;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
- at SpecVersion("20081222")
-public class NewEnterpriseBeanTest extends AbstractTest
-{
- private EnterpriseBean<WrappedEnterpriseBean> wrappedEnterpriseBean;
- private NewEnterpriseBean<WrappedEnterpriseBean> newEnterpriseBean;
-
- @BeforeMethod
- public void initNewBean() {
- addToEjbCache(WrappedEnterpriseBean.class);
- wrappedEnterpriseBean = EnterpriseBean.of(WrappedEnterpriseBean.class, manager);
- manager.addBean(wrappedEnterpriseBean);
- newEnterpriseBean = NewEnterpriseBean.of(WrappedEnterpriseBean.class, manager);
- manager.addBean(newEnterpriseBean);
- }
-
- @Test(groups = { "new", "broken" })
- public void testNewBeanHasImplementationClassOfInjectionPointType()
- {
- assert newEnterpriseBean.getType().equals(WrappedSimpleBean.class);
- }
-
- @Test(groups = { "new" })
- public void testNewBeanIsEnterpriseWebBeanIfParameterTypeIsEnterpriseWebBean()
- {
- assert wrappedEnterpriseBean.getType().equals(newEnterpriseBean.getType());
- assert manager.getEjbDescriptorCache().containsKey(newEnterpriseBean.getType());
- }
-
- @Test(groups = { "new" })
- public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
- {
- assert newEnterpriseBean.getInitializerMethods().equals(wrappedEnterpriseBean.getInitializerMethods());
- }
-
- @Test(groups = { "new" })
- public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
- {
- Set<AnnotatedItem<?, ?>> wrappedBeanInjectionPoints = wrappedEnterpriseBean.getAnnotatedInjectionPoints();
- Set<AnnotatedItem<?, ?>> newBeanInjectionPoints = newEnterpriseBean.getAnnotatedInjectionPoints();
- assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
- }
-
- @Test(groups = { "new" })
- public void testNewBeanHasNoDisposalMethods()
- {
- Class<?> type = TypeInfo.ofTypes(newEnterpriseBean.getTypes()).getSuperClass();
- assert manager.resolveDisposalMethods(type, newEnterpriseBean.getBindings().toArray(new Annotation[0])).isEmpty();
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewSimpleBeanTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewSimpleBeanTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/NewSimpleBeanTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,60 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import java.util.Set;
-
-import org.jboss.webbeans.bean.NewSimpleBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.newbean.valid.WrappedSimpleBean;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
- at SpecVersion("20081222")
-public class NewSimpleBeanTest extends AbstractTest
-{
- private SimpleBean<WrappedSimpleBean> wrappedSimpleBean;
- private NewSimpleBean<WrappedSimpleBean> newSimpleBean;
-
- @BeforeMethod
- public void initNewBean() {
- wrappedSimpleBean = SimpleBean.of(WrappedSimpleBean.class, manager);
- manager.addBean(wrappedSimpleBean);
- newSimpleBean = NewSimpleBean.of(WrappedSimpleBean.class, manager);
- manager.addBean(newSimpleBean);
- }
-
- @Test(groups = { "new" })
- public void testNewBeanHasImplementationClassOfInjectionPointType()
- {
- assert newSimpleBean.getType().equals(WrappedSimpleBean.class);
- }
-
- @Test(groups = { "new" })
- public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
- {
- assert newSimpleBean.getType().equals(wrappedSimpleBean.getType());
- }
-
- @Test(groups = { "new" })
- public void testNewBeanHasSameConstructorAsWrappedBean()
- {
- assert wrappedSimpleBean.getConstructor().equals(newSimpleBean.getConstructor());
- }
-
- @Test(groups = { "new" })
- public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
- {
- assert newSimpleBean.getInitializerMethods().equals(wrappedSimpleBean.getInitializerMethods());
- }
-
- @Test(groups = { "new" })
- public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
- {
- Set<AnnotatedItem<?, ?>> wrappedBeanInjectionPoints = wrappedSimpleBean.getAnnotatedInjectionPoints();
- Set<AnnotatedItem<?, ?>> newBeanInjectionPoints = newSimpleBean.getAnnotatedInjectionPoints();
- assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/PassivatingContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/PassivatingContextTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/PassivatingContextTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,54 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.ConversationScoped;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.SessionScoped;
-
-import org.jboss.webbeans.MetaDataCache;
-import org.testng.annotations.Test;
-
-public class PassivatingContextTest extends org.jboss.webbeans.test.AbstractTest
-{
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsSessionScopePassivating()
- {
- assert MetaDataCache.instance().getScopeModel(SessionScoped.class).isPassivating();
- }
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsConversationScopePassivating()
- {
- assert MetaDataCache.instance().getScopeModel(ConversationScoped.class).isPassivating();
- }
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsApplicationScopeNonPassivating()
- {
- assert !MetaDataCache.instance().getScopeModel(ApplicationScoped.class).isPassivating();
- }
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsRequestScopeNonPassivating()
- {
- assert !MetaDataCache.instance().getScopeModel(RequestScoped.class).isPassivating();
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ResolutionByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ResolutionByTypeTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ResolutionByTypeTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,89 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import java.util.Set;
-
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.binding.CurrentBinding;
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
-import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
-import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.beans.Animal;
-import org.jboss.webbeans.test.beans.Cod;
-import org.jboss.webbeans.test.beans.FishFarm;
-import org.jboss.webbeans.test.beans.Haddock;
-import org.jboss.webbeans.test.beans.Salmon;
-import org.jboss.webbeans.test.beans.ScottishFish;
-import org.jboss.webbeans.test.beans.SeaBass;
-import org.jboss.webbeans.test.beans.Sole;
-import org.jboss.webbeans.test.beans.Tuna;
-import org.testng.annotations.Test;
-
- at SpecVersion("20081206")
-public class ResolutionByTypeTest extends AbstractTest
-{
-
- private AnnotatedClass<FishFarm> fishFarmClass = new AnnotatedClassImpl<FishFarm>(FishFarm.class);
-
- @Test(groups="resolution")
- public void testAnnotatedField() throws Exception
- {
- AnnotatedField<Tuna> tuna = new AnnotatedFieldImpl<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
- assert tuna.getType().isAssignableFrom(Tuna.class);
- assert tuna.getBindingTypes().size() == 1;
- assert tuna.getBindingTypes().contains(new CurrentBinding());
- assert tuna.getType().isAssignableFrom(Tuna.class);
- }
-
- @Test
- public void testOneBindingType() throws Exception
- {
- AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
- Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
- Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
- Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
- manager.addBean(codBean);
- manager.addBean(salmonBean);
- manager.addBean(soleBean);
- Set<Bean<ScottishFish>> possibleTargets = manager.resolveByType(whiteScottishFishField);
- assert possibleTargets.size() == 2;
- assert possibleTargets.contains(codBean);
- assert possibleTargets.contains(soleBean);
- }
-
- @Test
- public void testABindingType() throws Exception
- {
- AnnotatedField<Animal> whiteChunkyFishField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"), fishFarmClass);
-
- Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
- Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
- Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
-
- manager.addBean(codBean);
- manager.addBean(salmonBean);
- manager.addBean(soleBean);
- Set<Bean<Animal>> possibleTargets = manager.resolveByType(whiteChunkyFishField);
- assert possibleTargets.size() == 1;
- assert possibleTargets.contains(codBean);
- }
-
- @Test
- public void testMultipleApiTypeWithCurrent() throws Exception
- {
- AnnotatedField<Animal> animalField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("animal"), fishFarmClass);
- Bean<SeaBass> seaBassBean = SimpleBean.of(SeaBass.class, manager);
- Bean<Haddock> haddockBean = SimpleBean.of(Haddock.class, manager);
- manager.addBean(seaBassBean);
- manager.addBean(haddockBean);
- Set<Bean<Animal>> possibleTargets = manager.resolveByType(animalField);
- assert possibleTargets.size() == 2;
- assert possibleTargets.contains(seaBassBean);
- assert possibleTargets.contains(haddockBean);
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/StereotypesTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/StereotypesTest.java 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/StereotypesTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -1,62 +0,0 @@
-package org.jboss.webbeans.test.unit;
-
-import java.util.Arrays;
-
-import javax.webbeans.RequestScoped;
-
-import org.jboss.webbeans.model.StereotypeModel;
-import org.jboss.webbeans.test.AbstractTest;
-import org.jboss.webbeans.test.SpecVersion;
-import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
-import org.jboss.webbeans.test.annotations.AnimalStereotype;
-import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
-import org.jboss.webbeans.test.beans.Animal;
-import org.jboss.webbeans.test.beans.Order;
-import org.testng.annotations.Test;
-
- at SpecVersion("20081206")
-public class StereotypesTest extends AbstractTest
-{
-
- @Test
- public void testAnimalStereotype()
- {
- StereotypeModel<AnimalStereotype> animalStereotype = new StereotypeModel<AnimalStereotype>(AnimalStereotype.class);
- assert animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 1;
- assert animalStereotype.getRequiredTypes().contains(Animal.class);
- assert animalStereotype.getSupportedScopes().size() == 0;
- assert !animalStereotype.isBeanNameDefaulted();
- assert animalStereotype.getDefaultDeploymentType() == null;
- }
-
- @Test
- public void testAnimalOrderStereotype()
- {
- StereotypeModel<AnimalOrderStereotype> animalStereotype = new StereotypeModel<AnimalOrderStereotype>(AnimalOrderStereotype.class);
- assert animalStereotype.getDefaultScopeType() == null;
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 2;
- Class<?> [] requiredTypes = {Animal.class, Order.class};
- assert animalStereotype.getRequiredTypes().containsAll(Arrays.asList(requiredTypes));
- assert animalStereotype.getSupportedScopes().size() == 0;
- assert !animalStereotype.isBeanNameDefaulted();
- assert animalStereotype.getDefaultDeploymentType() == null;
- }
-
- @Test
- public void testRequestScopedAnimalStereotype()
- {
- StereotypeModel<RequestScopedAnimalStereotype> animalStereotype = new StereotypeModel<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class);
- assert animalStereotype.getDefaultScopeType() == null;
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 1;
- assert Animal.class.equals(animalStereotype.getRequiredTypes().iterator().next());
- assert animalStereotype.getSupportedScopes().size() == 1;
- assert animalStereotype.getSupportedScopes().contains(RequestScoped.class);
- assert !animalStereotype.isBeanNameDefaulted();
- assert animalStereotype.getDefaultDeploymentType() == null;
- }
-
-}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Animal.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Animal.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Animal.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+interface Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Animal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/AnotherDeploymentType.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/AnotherDeploymentType.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/AnotherDeploymentType.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.DeploymentType;
+
+ at Target( { TYPE, METHOD })
+ at Retention(RUNTIME)
+ at Documented
+ at DeploymentType
+ at interface AnotherDeploymentType
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BoostrapTest.java (from rev 1036, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/BoostrapTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BoostrapTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BoostrapTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,274 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.bean.AbstractBean;
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
+import org.testng.annotations.Test;
+
+public class BoostrapTest extends AbstractTest
+{
+ @Test(groups="bootstrap")
+ public void testSingleSimpleBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Tuna.class));
+ webBeansBootstrap.boot();
+ List<Bean<?>> beans = manager.getBeans();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(Tuna.class);
+ }
+
+ @Test(groups="bootstrap")
+ public void testSingleEnterpriseBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class));
+ webBeansBootstrap.boot();
+ List<Bean<?>> beans = manager.getBeans();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(Hound.class);
+ }
+
+ @Test(groups="bootstrap")
+ public void testMultipleSimpleBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Tuna.class, Salmon.class, SeaBass.class, Sole.class));
+ webBeansBootstrap.boot();
+ List<Bean<?>> beans = manager.getBeans();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(Tuna.class);
+ assert classes.containsKey(Salmon.class);
+ assert classes.containsKey(SeaBass.class);
+ assert classes.containsKey(Sole.class);
+
+ assert classes.get(Tuna.class) instanceof SimpleBean;
+ assert classes.get(Salmon.class) instanceof SimpleBean;
+ assert classes.get(SeaBass.class) instanceof SimpleBean;
+ assert classes.get(Sole.class) instanceof SimpleBean;
+ }
+
+ @Test(groups="bootstrap")
+ public void testProducerMethodBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TarantulaProducer.class));
+ webBeansBootstrap.boot();
+ List<Bean<?>> beans = manager.getBeans();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(TarantulaProducer.class);
+ assert classes.containsKey(Tarantula.class);
+
+ assert classes.get(TarantulaProducer.class) instanceof SimpleBean;
+ assert classes.get(Tarantula.class) instanceof ProducerMethodBean;
+ }
+
+ @Test(groups="bootstrap")
+ public void testMultipleEnterpriseBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class));
+ webBeansBootstrap.boot();
+ List<Bean<?>> beans = manager.getBeans();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(Hound.class);
+ assert classes.containsKey(Elephant.class);
+ assert classes.containsKey(Panther.class);
+ assert classes.containsKey(Tiger.class);
+
+ assert classes.get(Hound.class) instanceof EnterpriseBean;
+ assert classes.get(Elephant.class) instanceof EnterpriseBean;
+ assert classes.get(Panther.class) instanceof EnterpriseBean;
+ assert classes.get(Tiger.class) instanceof EnterpriseBean;
+ }
+
+ @Test(groups="bootstrap")
+ public void testMultipleEnterpriseAndSimpleBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
+ webBeansBootstrap.boot();
+ List<Bean<?>> beans = manager.getBeans();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : beans)
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(Hound.class);
+ assert classes.containsKey(Elephant.class);
+ assert classes.containsKey(Panther.class);
+ assert classes.containsKey(Tiger.class);
+ assert classes.containsKey(Tuna.class);
+ assert classes.containsKey(Salmon.class);
+ assert classes.containsKey(SeaBass.class);
+ assert classes.containsKey(Sole.class);
+
+ assert classes.get(Hound.class) instanceof EnterpriseBean;
+ assert classes.get(Elephant.class) instanceof EnterpriseBean;
+ assert classes.get(Panther.class) instanceof EnterpriseBean;
+ assert classes.get(Tiger.class) instanceof EnterpriseBean;
+ assert classes.get(Tuna.class) instanceof SimpleBean;
+ assert classes.get(Salmon.class) instanceof SimpleBean;
+ assert classes.get(SeaBass.class) instanceof SimpleBean;
+ assert classes.get(Sole.class) instanceof SimpleBean;
+ }
+
+ @Test(groups="bootstrap")
+ public void testRegisterProducerMethodBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(TarantulaProducer.class));
+ webBeansBootstrap.boot();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : manager.getBeans())
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(TarantulaProducer.class);
+ assert classes.containsKey(Tarantula.class);
+
+
+ assert classes.get(TarantulaProducer.class) instanceof SimpleBean;
+ assert classes.get(Tarantula.class) instanceof ProducerMethodBean;
+ }
+
+ @Test(groups="bootstrap")
+ public void testRegisterMultipleEnterpriseAndSimpleBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
+ webBeansBootstrap.boot();
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : manager.getBeans())
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(Hound.class);
+ assert classes.containsKey(Elephant.class);
+ assert classes.containsKey(Panther.class);
+ assert classes.containsKey(Tiger.class);
+ assert classes.containsKey(Tuna.class);
+ assert classes.containsKey(Salmon.class);
+ assert classes.containsKey(SeaBass.class);
+ assert classes.containsKey(Sole.class);
+
+ assert classes.get(Hound.class) instanceof EnterpriseBean;
+ assert classes.get(Elephant.class) instanceof EnterpriseBean;
+ assert classes.get(Panther.class) instanceof EnterpriseBean;
+ assert classes.get(Tiger.class) instanceof EnterpriseBean;
+ assert classes.get(Tuna.class) instanceof SimpleBean;
+ assert classes.get(Salmon.class) instanceof SimpleBean;
+ assert classes.get(SeaBass.class) instanceof SimpleBean;
+ assert classes.get(Sole.class) instanceof SimpleBean;
+ }
+
+ @Test(groups="bootstrap", expectedExceptions=IllegalStateException.class)
+ public void testDiscoverFails()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(null);
+ webBeansBootstrap.boot();
+ }
+
+ @Test(groups="bootstrap")
+ public void testDiscover()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(Hound.class, Elephant.class, Panther.class, Tiger.class, Tuna.class, Salmon.class, SeaBass.class, Sole.class));
+ webBeansBootstrap.boot();
+
+ Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+ for (Bean<?> bean : manager.getBeans())
+ {
+ if (bean instanceof AbstractBean)
+ {
+ classes.put(((AbstractBean<?, ?>) bean).getType(), bean);
+ }
+ }
+ assert classes.containsKey(Hound.class);
+ assert classes.containsKey(Elephant.class);
+ assert classes.containsKey(Panther.class);
+ assert classes.containsKey(Tiger.class);
+ assert classes.containsKey(Tuna.class);
+ assert classes.containsKey(Salmon.class);
+ assert classes.containsKey(SeaBass.class);
+ assert classes.containsKey(Sole.class);
+
+ assert classes.get(Hound.class) instanceof EnterpriseBean;
+ assert classes.get(Elephant.class) instanceof EnterpriseBean;
+ assert classes.get(Panther.class) instanceof EnterpriseBean;
+ assert classes.get(Tiger.class) instanceof EnterpriseBean;
+ assert classes.get(Tuna.class) instanceof SimpleBean;
+ assert classes.get(Salmon.class) instanceof SimpleBean;
+ assert classes.get(SeaBass.class) instanceof SimpleBean;
+ assert classes.get(Sole.class) instanceof SimpleBean;
+ }
+
+ @Test(groups="bootstrap")
+ public void testInitializedEvent()
+ {
+ assert !InitializedObserver.observered;
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(InitializedObserver.class));
+ webBeansBootstrap.boot();
+
+ assert InitializedObserver.observered;
+ }
+
+ @Test(groups="bootstrap")
+ public void testRequestContextActiveDuringInitializtionEvent()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(InitializedObserverWhichUsesRequestContext.class, Tuna.class));
+ webBeansBootstrap.boot();
+ }
+
+ @Test(groups={"bootstrap", "broken"})
+ public void testApplicationContextActiveDuringInitializtionEvent()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(InitializedObserverWhichUsesApplicationContext.class, LadybirdSpider.class));
+ webBeansBootstrap.boot();
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/BoostrapTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlyAnimal.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlyAnimal.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlyAnimal.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+interface DeadlyAnimal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlyAnimal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlySpider.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlySpider.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlySpider.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+interface DeadlySpider extends DeadlyAnimal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DeadlySpider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DefangedTarantula.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DefangedTarantula.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DefangedTarantula.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+class DefangedTarantula extends Tarantula
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DefangedTarantula.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Elephant.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Elephant.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Elephant.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,25 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Destructor;
+import javax.webbeans.Production;
+
+ at Production
+ at Stateful
+class Elephant
+{
+
+ @Remove
+ public void remove1()
+ {
+
+ }
+
+ @Remove @Destructor
+ public void remove2()
+ {
+
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Elephant.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Hound.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Hound.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Hound.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Named;
+
+ at Stateful
+ at Tame
+ at Named("Pongo")
+class Hound
+{
+ @Remove
+ public void bye() {
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Hound.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserver.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserver.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserver.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+class InitializedObserver
+{
+
+ public static boolean observered;
+
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ observered = true;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesApplicationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesApplicationContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesApplicationContext.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.Current;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+class InitializedObserverWhichUsesApplicationContext
+{
+
+ @Current LadybirdSpider spider;
+
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ spider.spinWeb();
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesApplicationContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesRequestContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesRequestContext.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesRequestContext.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.Current;
+import javax.webbeans.Observes;
+import javax.webbeans.manager.Initialized;
+import javax.webbeans.manager.Manager;
+
+class InitializedObserverWhichUsesRequestContext
+{
+
+ @Current Tuna tuna;
+
+ public void observeInitialized(@Observes @Initialized Manager manager)
+ {
+ tuna.getName();
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InitializedObserverWhichUsesRequestContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/LadybirdSpider.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/LadybirdSpider.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/LadybirdSpider.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.ApplicationScoped;
+
+ at ApplicationScoped
+class LadybirdSpider extends Spider
+{
+
+ public void spinWeb()
+ {
+
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/LadybirdSpider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Panther.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Panther.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Panther.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Production;
+
+ at Production
+ at Stateful
+class Panther
+{
+
+ @Remove
+ public void remove(String foo)
+ {
+
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Panther.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Salmon.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Salmon.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Salmon.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+
+ at Production
+ at Named
+class Salmon implements ScottishFish
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Salmon.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ScottishFish.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ScottishFish.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ScottishFish.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+interface ScottishFish extends Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ScottishFish.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/SeaBass.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/SeaBass.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/SeaBass.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+
+ at Production
+ at RequestScoped
+class SeaBass implements Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/SeaBass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Sole.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Sole.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Sole.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+
+ at Production
+ at Whitefish
+ at Named("whitefish")
+class Sole implements ScottishFish
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Sole.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Spider.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Spider.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Spider.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+class Spider implements Animal
+{
+
+ public final void layEggs()
+ {
+
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Spider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tame.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tame.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tame.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Tame
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tame.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tarantula.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tarantula.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tarantula.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+class Tarantula extends Spider implements DeadlySpider
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tarantula.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/TarantulaProducer.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/TarantulaProducer.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/TarantulaProducer.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.Produces;
+
+public class TarantulaProducer
+{
+
+ @Produces @Tame public Tarantula produceTameTarantula()
+ {
+ return new DefangedTarantula();
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/TarantulaProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tiger.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tiger.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tiger.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Production;
+
+import org.jboss.webbeans.test.annotations.Synchronous;
+
+ at Production
+ at Stateful
+ at Synchronous
+public class Tiger
+{
+
+ @Remove
+ public void remove()
+ {
+
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tiger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tuna.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tuna.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tuna.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import javax.webbeans.RequestScoped;
+
+ at RequestScoped
+class Tuna
+{
+
+ public String getName()
+ {
+ return "Ophir";
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Tuna.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Whitefish.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Whitefish.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Whitefish.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.unit.bootstrap;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+public @interface Whitefish
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/bootstrap/Whitefish.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java (from rev 1039, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/PassivatingContextTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,54 @@
+package org.jboss.webbeans.test.unit.context;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.ConversationScoped;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.SessionScoped;
+
+import org.jboss.webbeans.MetaDataCache;
+import org.testng.annotations.Test;
+
+public class PassivatingContextTest extends org.jboss.webbeans.test.AbstractTest
+{
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "contexts", "passivation" })
+ public void testIsSessionScopePassivating()
+ {
+ assert MetaDataCache.instance().getScopeModel(SessionScoped.class).isPassivating();
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "contexts", "passivation" })
+ public void testIsConversationScopePassivating()
+ {
+ assert MetaDataCache.instance().getScopeModel(ConversationScoped.class).isPassivating();
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "contexts", "passivation" })
+ public void testIsApplicationScopeNonPassivating()
+ {
+ assert !MetaDataCache.instance().getScopeModel(ApplicationScoped.class).isPassivating();
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test(groups = { "contexts", "passivation" })
+ public void testIsRequestScopeNonPassivating()
+ {
+ assert !MetaDataCache.instance().getScopeModel(RequestScoped.class).isPassivating();
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Animal.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Animal.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Animal.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.definition;
+
+interface Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Animal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,19 @@
+package org.jboss.webbeans.test.unit.definition;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.Stereotype;
+
+
+
+ at Stereotype(requiredTypes={Animal.class, Order.class})
+ at Target( { TYPE })
+ at Retention(RUNTIME)
+ at interface AnimalOrderStereotype
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.test.unit.definition;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.RequestScoped;
+import javax.webbeans.Stereotype;
+
+ at Stereotype(requiredTypes=Animal.class)
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at RequestScoped
+ at interface AnimalStereotype
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Order.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Order.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Order.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.test.unit.definition;
+
+import javax.webbeans.Production;
+
+ at Production
+class Order
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/Order.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,18 @@
+package org.jboss.webbeans.test.unit.definition;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.RequestScoped;
+import javax.webbeans.Stereotype;
+
+ at Stereotype(requiredTypes=Animal.class, supportedScopes=RequestScoped.class)
+ at Target( { TYPE })
+ at Retention(RUNTIME)
+public @interface RequestScopedAnimalStereotype
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java (from rev 1037, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/StereotypesTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,57 @@
+package org.jboss.webbeans.test.unit.definition;
+
+import java.util.Arrays;
+
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.model.StereotypeModel;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecVersion;
+import org.testng.annotations.Test;
+
+ at SpecVersion("20081206")
+public class StereotypesTest extends AbstractTest
+{
+
+ @Test
+ public void testAnimalStereotype()
+ {
+ StereotypeModel<AnimalStereotype> animalStereotype = new StereotypeModel<AnimalStereotype>(AnimalStereotype.class);
+ assert animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
+ assert animalStereotype.getInterceptorBindings().size() == 0;
+ assert animalStereotype.getRequiredTypes().size() == 1;
+ assert animalStereotype.getRequiredTypes().contains(Animal.class);
+ assert animalStereotype.getSupportedScopes().size() == 0;
+ assert !animalStereotype.isBeanNameDefaulted();
+ assert animalStereotype.getDefaultDeploymentType() == null;
+ }
+
+ @Test
+ public void testAnimalOrderStereotype()
+ {
+ StereotypeModel<AnimalOrderStereotype> animalStereotype = new StereotypeModel<AnimalOrderStereotype>(AnimalOrderStereotype.class);
+ assert animalStereotype.getDefaultScopeType() == null;
+ assert animalStereotype.getInterceptorBindings().size() == 0;
+ assert animalStereotype.getRequiredTypes().size() == 2;
+ Class<?> [] requiredTypes = {Animal.class, Order.class};
+ assert animalStereotype.getRequiredTypes().containsAll(Arrays.asList(requiredTypes));
+ assert animalStereotype.getSupportedScopes().size() == 0;
+ assert !animalStereotype.isBeanNameDefaulted();
+ assert animalStereotype.getDefaultDeploymentType() == null;
+ }
+
+ @Test
+ public void testRequestScopedAnimalStereotype()
+ {
+ StereotypeModel<RequestScopedAnimalStereotype> animalStereotype = new StereotypeModel<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class);
+ assert animalStereotype.getDefaultScopeType() == null;
+ assert animalStereotype.getInterceptorBindings().size() == 0;
+ assert animalStereotype.getRequiredTypes().size() == 1;
+ assert Animal.class.equals(animalStereotype.getRequiredTypes().iterator().next());
+ assert animalStereotype.getSupportedScopes().size() == 1;
+ assert animalStereotype.getSupportedScopes().contains(RequestScoped.class);
+ assert !animalStereotype.isBeanNameDefaulted();
+ assert animalStereotype.getDefaultDeploymentType() == null;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/AnotherDeploymentType.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/AnotherDeploymentType.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/AnotherDeploymentType.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.unit.event;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.DeploymentType;
+
+ at Target( { TYPE, METHOD })
+ at Retention(RUNTIME)
+ at Documented
+ at DeploymentType
+ at interface AnotherDeploymentType
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Asynchronous.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Asynchronous.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Asynchronous.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.test.unit.event;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Asynchronous
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Asynchronous.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java (from rev 1036, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/DeferredEventNotificationTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,79 @@
+package org.jboss.webbeans.test.unit.event;
+
+import java.util.Arrays;
+
+import javax.webbeans.Observes;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
+import org.jboss.webbeans.test.AbstractTest;
+import org.testng.annotations.Test;
+
+/**
+ * Unit tests for the deferred event notification object used to delay
+ * notification till the end of a transaction.
+ *
+ * @author David Allen
+ *
+ */
+public class DeferredEventNotificationTest extends AbstractTest
+{
+
+ public class Event
+ {
+ // Simple class used for testing
+ }
+
+ @Override
+ protected void addStandardDeploymentTypesForTests()
+ {
+ manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, AnotherDeploymentType.class));
+ }
+
+ public class AnObserver
+ {
+ protected boolean notified = false;
+
+ public void observe(@Observes @Asynchronous Event e)
+ {
+ // An observer method
+ this.notified = true;
+ }
+ }
+
+ /**
+ * Test method for
+ * {@link org.jboss.webbeans.event.DeferredEventNotification#beforeCompletion()}
+ * .
+ */
+ @Test(groups={"deferredEvent", "broken"})
+ public final void testBeforeCompletion() throws Exception
+ {
+ // When the transaction is committed, the beforeCompletion() method is
+ // invoked which in turn invokes the observer. Here the mock observer
+ // is used to keep track of the event being fired.
+ SimpleBean<Tuna> tuna;
+ AnnotatedMethod<Object> om;
+
+
+ // Create an observer with known binding types
+ //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ //annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
+ //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+ // TODO This should test a real class
+ tuna = SimpleBean.of(Tuna.class, manager);
+ om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), new AnnotatedClassImpl<AnObserver>(AnObserver.class));
+
+ AnObserver observerInstance = new AnObserver();
+ // TODO Fix this Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);
+ //((MockObserverImpl<Event>) observer).setInstance(observerInstance);
+ Event event = new Event();
+ //DeferredEventNotification<Event> deferredNotification = new DeferredEventNotification<Event>(event, observer);
+ //deferredNotification.beforeCompletion();
+ assert observerInstance.notified;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/DeferredEventNotificationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Tuna.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Tuna.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Tuna.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.unit.event;
+
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
+
+ at AnotherDeploymentType
+ at RequestScoped
+class Tuna
+{
+
+ public String getName()
+ {
+ return "Ophir";
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/event/Tuna.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Animal.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Animal.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Animal.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+interface Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Animal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Antelope.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Antelope.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Antelope.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+class Antelope implements Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Antelope.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java (from rev 1036, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ClassAnnotatedItemTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,48 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+import java.lang.annotation.Annotation;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.webbeans.DeploymentType;
+import javax.webbeans.Production;
+import javax.webbeans.Stereotype;
+
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.testng.annotations.Test;
+
+public class ClassAnnotatedItemTest
+{
+
+ @Test
+ public void testDeclaredAnnotations()
+ {
+ AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+ assert annotatedElement.getAnnotations().size() == 1;
+ assert annotatedElement.getAnnotation(Production.class) != null;
+ assert annotatedElement.getType().equals(Order.class);
+ }
+
+ @Test
+ public void testMetaAnnotations()
+ {
+ AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+ Set<Annotation> annotations = annotatedElement.getMetaAnnotations(DeploymentType.class);
+ assert annotations.size() == 1;
+ Iterator<Annotation> it = annotations.iterator();
+ Annotation production = it.next();
+ assert Production.class.equals(production.annotationType());
+ }
+
+ @Test
+ public void testEmpty()
+ {
+ AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
+ assert annotatedElement.getAnnotation(Stereotype.class) == null;
+ assert annotatedElement.getMetaAnnotations(Stereotype.class).size() == 0;
+ AnnotatedClass<Antelope> classWithNoAnnotations = new AnnotatedClassImpl<Antelope>(Antelope.class);
+ assert classWithNoAnnotations.getAnnotations().size() == 0;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/ClassAnnotatedItemTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,64 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import org.jboss.webbeans.bean.EnterpriseBean;
+import org.jboss.webbeans.bean.NewEnterpriseBean;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecVersion;
+import org.jboss.webbeans.util.Proxies.TypeInfo;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+ at SpecVersion("20081222")
+public class NewEnterpriseBeanTest extends AbstractTest
+{
+ private EnterpriseBean<WrappedEnterpriseBean> wrappedEnterpriseBean;
+ private NewEnterpriseBean<WrappedEnterpriseBean> newEnterpriseBean;
+
+ @BeforeMethod
+ public void initNewBean() {
+ addToEjbCache(WrappedEnterpriseBean.class);
+ wrappedEnterpriseBean = EnterpriseBean.of(WrappedEnterpriseBean.class, manager);
+ manager.addBean(wrappedEnterpriseBean);
+ newEnterpriseBean = NewEnterpriseBean.of(WrappedEnterpriseBean.class, manager);
+ manager.addBean(newEnterpriseBean);
+ }
+
+ @Test(groups = { "new", "broken" })
+ public void testNewBeanHasImplementationClassOfInjectionPointType()
+ {
+ assert newEnterpriseBean.getType().equals(WrappedEnterpriseBean.class);
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanIsEnterpriseWebBeanIfParameterTypeIsEnterpriseWebBean()
+ {
+ assert wrappedEnterpriseBean.getType().equals(newEnterpriseBean.getType());
+ assert manager.getEjbDescriptorCache().containsKey(newEnterpriseBean.getType());
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
+ {
+ assert newEnterpriseBean.getInitializerMethods().equals(wrappedEnterpriseBean.getInitializerMethods());
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
+ {
+ Set<AnnotatedItem<?, ?>> wrappedBeanInjectionPoints = wrappedEnterpriseBean.getAnnotatedInjectionPoints();
+ Set<AnnotatedItem<?, ?>> newBeanInjectionPoints = newEnterpriseBean.getAnnotatedInjectionPoints();
+ assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanHasNoDisposalMethods()
+ {
+ Class<?> type = TypeInfo.ofTypes(newEnterpriseBean.getTypes()).getSuperClass();
+ assert manager.resolveDisposalMethods(type, newEnterpriseBean.getBindings().toArray(new Annotation[0])).isEmpty();
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewSimpleBeanTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewSimpleBeanTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/NewSimpleBeanTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,59 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+import java.util.Set;
+
+import org.jboss.webbeans.bean.NewSimpleBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.test.AbstractTest;
+import org.jboss.webbeans.test.SpecVersion;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+ at SpecVersion("20081222")
+public class NewSimpleBeanTest extends AbstractTest
+{
+ private SimpleBean<WrappedSimpleBean> wrappedSimpleBean;
+ private NewSimpleBean<WrappedSimpleBean> newSimpleBean;
+
+ @BeforeMethod
+ public void initNewBean() {
+ wrappedSimpleBean = SimpleBean.of(WrappedSimpleBean.class, manager);
+ manager.addBean(wrappedSimpleBean);
+ newSimpleBean = NewSimpleBean.of(WrappedSimpleBean.class, manager);
+ manager.addBean(newSimpleBean);
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanHasImplementationClassOfInjectionPointType()
+ {
+ assert newSimpleBean.getType().equals(WrappedSimpleBean.class);
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
+ {
+ assert newSimpleBean.getType().equals(wrappedSimpleBean.getType());
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanHasSameConstructorAsWrappedBean()
+ {
+ assert wrappedSimpleBean.getConstructor().equals(newSimpleBean.getConstructor());
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
+ {
+ assert newSimpleBean.getInitializerMethods().equals(wrappedSimpleBean.getInitializerMethods());
+ }
+
+ @Test(groups = { "new" })
+ public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
+ {
+ Set<AnnotatedItem<?, ?>> wrappedBeanInjectionPoints = wrappedSimpleBean.getAnnotatedInjectionPoints();
+ Set<AnnotatedItem<?, ?>> newBeanInjectionPoints = newSimpleBean.getAnnotatedInjectionPoints();
+ assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Order.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Order.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Order.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+import javax.webbeans.Production;
+
+ at Production
+class Order
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/Order.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedEnterpriseBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedEnterpriseBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedEnterpriseBean.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.webbeans.Named;
+import javax.webbeans.SessionScoped;
+
+ at SessionScoped
+ at Stateful
+ at Named("John")
+class WrappedEnterpriseBean
+{
+ @Remove
+ public void bye() {
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedEnterpriseBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedSimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedSimpleBean.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedSimpleBean.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.unit.implementation;
+
+import java.io.Serializable;
+
+import javax.webbeans.Named;
+import javax.webbeans.SessionScoped;
+
+ at SessionScoped
+ at Named("Fred")
+class WrappedSimpleBean implements Serializable
+{
+ public WrappedSimpleBean() {
+
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/implementation/WrappedSimpleBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Animal.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Animal.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Animal.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+interface Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Animal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/AnotherDeploymentType.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/AnotherDeploymentType.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/AnotherDeploymentType.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.DeploymentType;
+
+ at Target( { TYPE, METHOD })
+ at Retention(RUNTIME)
+ at Documented
+ at DeploymentType
+ at interface AnotherDeploymentType
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Chunky.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Chunky.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Chunky.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,24 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Chunky
+{
+
+ boolean realChunky();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Chunky.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Cod.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Cod.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Cod.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+
+
+ at Production
+ at Whitefish
+ at Chunky(realChunky=true)
+ at Named("whitefish")
+class Cod implements ScottishFish
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Cod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Expensive.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Expensive.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Expensive.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,28 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+import javax.webbeans.NonBinding;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Expensive
+{
+
+ boolean veryExpensive();
+
+ @NonBinding
+ int cost();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Expensive.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Farmer.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Farmer.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Farmer.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.Production;
+
+ at Production
+class Farmer<T>
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Farmer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/FishFarm.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/FishFarm.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/FishFarm.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,37 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.Current;
+import javax.webbeans.Production;
+
+ at Production
+class FishFarm
+{
+
+ @SuppressWarnings("unused")
+ @Current
+ public Tuna tuna;
+
+ @SuppressWarnings("unused")
+ @Current
+ public Animal animal;
+
+ @SuppressWarnings("unused")
+ @Whitefish
+ public ScottishFish whiteScottishFish;
+
+ @SuppressWarnings("unused")
+ @Whitefish
+ public Animal whiteFish;
+
+ @SuppressWarnings("unused")
+ @Whitefish @Chunky(realChunky=true)
+ public Animal realChunkyWhiteFish;
+
+ @SuppressWarnings("unused")
+ @Current
+ public Farmer<ScottishFish> scottishFishFarmer;
+
+ @Expensive(cost=60, veryExpensive=true) @Whitefish
+ public Animal veryExpensiveWhitefish;
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/FishFarm.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Haddock.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Haddock.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Haddock.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+
+ at Production
+ at Named
+class Haddock implements Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Haddock.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java (from rev 1036, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/ResolutionByTypeTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,78 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import java.util.Set;
+
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.binding.CurrentBinding;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
+import org.jboss.webbeans.test.AbstractTest;
+import org.testng.annotations.Test;
+
+public class ResolutionByTypeTest extends AbstractTest
+{
+
+ private AnnotatedClass<FishFarm> fishFarmClass = new AnnotatedClassImpl<FishFarm>(FishFarm.class);
+
+ @Test(groups="resolution")
+ public void testAnnotatedField() throws Exception
+ {
+ AnnotatedField<Tuna> tuna = new AnnotatedFieldImpl<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
+ assert tuna.getType().isAssignableFrom(Tuna.class);
+ assert tuna.getBindingTypes().size() == 1;
+ assert tuna.getBindingTypes().contains(new CurrentBinding());
+ assert tuna.getType().isAssignableFrom(Tuna.class);
+ }
+
+ @Test
+ public void testOneBindingType() throws Exception
+ {
+ AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
+ manager.addBean(codBean);
+ manager.addBean(salmonBean);
+ manager.addBean(soleBean);
+ Set<Bean<ScottishFish>> possibleTargets = manager.resolveByType(whiteScottishFishField);
+ assert possibleTargets.size() == 2;
+ assert possibleTargets.contains(codBean);
+ assert possibleTargets.contains(soleBean);
+ }
+
+ @Test
+ public void testABindingType() throws Exception
+ {
+ AnnotatedField<Animal> whiteChunkyFishField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"), fishFarmClass);
+
+ Bean<Cod> codBean = SimpleBean.of(Cod.class, manager);
+ Bean<Salmon> salmonBean = SimpleBean.of(Salmon.class, manager);
+ Bean<Sole> soleBean = SimpleBean.of(Sole.class, manager);
+
+ manager.addBean(codBean);
+ manager.addBean(salmonBean);
+ manager.addBean(soleBean);
+ Set<Bean<Animal>> possibleTargets = manager.resolveByType(whiteChunkyFishField);
+ assert possibleTargets.size() == 1;
+ assert possibleTargets.contains(codBean);
+ }
+
+ @Test
+ public void testMultipleApiTypeWithCurrent() throws Exception
+ {
+ AnnotatedField<Animal> animalField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("animal"), fishFarmClass);
+ Bean<SeaBass> seaBassBean = SimpleBean.of(SeaBass.class, manager);
+ Bean<Haddock> haddockBean = SimpleBean.of(Haddock.class, manager);
+ manager.addBean(seaBassBean);
+ manager.addBean(haddockBean);
+ Set<Bean<Animal>> possibleTargets = manager.resolveByType(animalField);
+ assert possibleTargets.size() == 2;
+ assert possibleTargets.contains(seaBassBean);
+ assert possibleTargets.contains(haddockBean);
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ResolutionByTypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Salmon.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Salmon.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Salmon.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+
+ at Production
+ at Named
+class Salmon implements ScottishFish
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Salmon.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ScottishFish.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ScottishFish.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ScottishFish.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+interface ScottishFish extends Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/ScottishFish.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/SeaBass.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/SeaBass.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/SeaBass.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+
+ at Production
+ at RequestScoped
+class SeaBass implements Animal
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/SeaBass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Sole.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Sole.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Sole.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+
+ at Production
+ at Whitefish
+ at Named("whitefish")
+class Sole implements ScottishFish
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Sole.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Tuna.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Tuna.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Tuna.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import javax.webbeans.RequestScoped;
+
+ at AnotherDeploymentType
+ at RequestScoped
+class Tuna
+{
+
+ public String getName()
+ {
+ return "Ophir";
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Tuna.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Whitefish.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Whitefish.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Whitefish.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.unit.lookup;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+ at interface Whitefish
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/Whitefish.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/unit-tests.xml
===================================================================
--- ri/trunk/webbeans-ri/unit-tests.xml 2009-01-17 19:12:36 UTC (rev 1044)
+++ ri/trunk/webbeans-ri/unit-tests.xml 2009-01-17 19:46:43 UTC (rev 1045)
@@ -33,13 +33,14 @@
</run>
</groups>
<packages>
- <package name="org.jboss.webbeans.test.tck"></package>
- <package name="org.jboss.webbeans.test"></package>
- <package name="org.jboss.webbeans.test.contexts"></package>
- <package name="org.jboss.webbeans.examples"></package>
- <package name="org.jboss.webbeans.test.ejb"></package>
- <package name="org.jboss.webbeans.test.newbean"></package>
- <package name="org.jboss.webbeans.test.unit"></package>
+ <package name="org.jboss.webbeans.test" />
+ <package name="org.jboss.webbeans.examples" />
+ <package name="org.jboss.webbeans.test.unit.bootstrap" />
+ <package name="org.jboss.webbeans.test.unit.context" />
+ <package name="org.jboss.webbeans.test.unit.definition" />
+ <package name="org.jboss.webbeans.test.unit.event" />
+ <package name="org.jboss.webbeans.test.unit.implementation" />
+ <package name="org.jboss.webbeans.test.unit.lookup" />
</packages>
</test>
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java 2009-01-17 19:46:43 UTC (rev 1045)
@@ -0,0 +1,28 @@
+package org.jboss.webbeans.tck.tests.implementation.commonAnnotations;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.tests.AbstractEjbEmbeddableTest;
+import org.testng.annotations.Test;
+
+public class ResourceInjectionTest extends AbstractEjbEmbeddableTest
+{
+
+ @Test(groups="stub") @SpecAssertion(section="3.10")
+ public void testInjectionOfPersistenceContext()
+ {
+ assert false;
+ }
+
+ @Test(groups="stub") @SpecAssertion(section="3.10")
+ public void testInjectionOfResource()
+ {
+ assert false;
+ }
+
+ @Test(groups="stub") @SpecAssertion(section="3.10")
+ public void testInjectionOfEJB()
+ {
+ assert false;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/implementation/commonAnnotations/ResourceInjectionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the weld-commits
mailing list