[weld-commits] Weld SVN: r6820 - in core/trunk/tests-arquillian/src: main/java/org/jboss/weld/test and 91 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Wed Jul 28 06:18:21 EDT 2010


Author: aslak
Date: 2010-07-28 06:18:08 -0400 (Wed, 28 Jul 2010)
New Revision: 6820

Added:
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/BeanWithInjection.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/MyBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SpecialBindingType.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Cow.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Donkey.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dummy.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dusk.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Field.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Horse.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NightTime.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScope.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Tame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/TestableObserverMethod.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Animal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Salmon.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/ScottishFish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/SeaBass.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Sole.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Tuna.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Whitefish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/Tuna.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Animal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Elephant.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ElephantLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Hound.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/HoundLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Panther.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/PantherLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Salmon.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ScottishFish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/SeaBass.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Sole.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Synchronous.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tiger.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/TigerLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tuna.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Whitefish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Animal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlyAnimal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlySpider.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DefangedTarantula.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Spider.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tarantula.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/TarantulaProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Elephant.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/ElephantLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Hound.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/HoundLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Panther.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/PantherLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Synchronous.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tiger.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/TigerLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Hound.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/HoundLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Tame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Checker.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Horse.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/HorseRemote.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Produced.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/AlteStadt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessorLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/FrankfurtAmMain.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GeschichtslosStadt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Giessen.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GrossStadt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GutenbergMuseum.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IndirectOrderProcessor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IntermediateOrderProcessor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Kassel.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/KleinStadt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/LandgraffenSchloss.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Mainz.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Marburg.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/MockCreationalContext.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/NeueStadt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessorLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/RoemerPassage.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Schloss.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/SchoeneStadt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/UniStadt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBeanLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/SimpleBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/FooException.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Large.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Lorry_Broken.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Ship.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ShipProducer_Broken.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeEjbExtension.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/BigLathe.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/ConveyorShaft.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Lathe.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/LatheLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Shaft.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/SmallLathe.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtension.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/Clothes.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/InjectLiteral.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/TumbleDryer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/FullMarathon.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Incremented.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/IncrementingInterceptor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtension.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/LifecycleInterceptor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Marathon.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/NumberSource.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Author.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/AuthorLiteral.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogFormatter.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogSource.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Consumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/ConsumerLiteral.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlog.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlogLiteral.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansExtension.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/UselessBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/other/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/other/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized1.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized2.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/TestBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/Mouse.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Baz.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Qux.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/SampleObserver.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/InjectedClass.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ScopedClass.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/Baz.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/FooDB.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/FooBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/Important.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanWithBinding.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/AbstractFactory.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/DummyParent.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntFactory.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntegerFactory.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/SomeBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/Sheep.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/UTConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerConsumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/Mock.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBeanLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Animal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalOrderStereotype.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalStereotype.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Order.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/RequestScopedAnimalStereotype.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Alt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Dec.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Int.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/IntBind.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Plain.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Fodder.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Horse.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Stable.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/SwitchableContainerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver1.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver2.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer1.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer2.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/ObserverBase.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Alt.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Bar.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cat.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Chicken.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cow.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Horse.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Pig.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Animal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlyAnimal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlySpider.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DefangedTarantula.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Hound.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/HoundLocal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Salmon.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ScottishFish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/SeaBass.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Sole.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Spider.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tarantula.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/TarantulaProducer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tuna.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Whitefish.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Quality.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Animal.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Antelope.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Kangaroo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Koala.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Order.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Possum.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Random.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/Choice.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SuperTestObject.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/TestObject.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/Chair.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/ComfyChair.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedCallable.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedElement.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedMember.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedConstructor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedField.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedMethod.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedParameter.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedType.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedTypeBuilder.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationBuilder.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationStore.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestTypeClosureBuilder.java
   core/trunk/tests-arquillian/src/test/resources/arquillian.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/builtinBeans/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/builtinBeans/ee/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/builtinBeans/ee/persistence.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/enterprise/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/enterprise/ejb-jar.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/resolution/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/resolution/circular/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/resolution/circular/resource/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/resolution/circular/resource/persistence.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/javax.enterprise.inject.spi.Extension
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/alternative.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/decorator.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/interceptor.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleAlternativeBlocks.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleDecoratorBlocks.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleInterceptorsBlocks.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/namespaced.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonDefaultNamespaced.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonPrettyPrinted.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unloadable.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unparseable.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/extensions/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/extensions/javax.enterprise.inject.spi.Extension
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/beans.xml
Log:
WELD-493 Added new batch of converted tests

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.test;
+
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_TYPE;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import javax.el.ELContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.TypeLiteral;
+
+import org.jboss.weld.bean.proxy.Proxy;
+import org.jboss.weld.exceptions.UnsatisfiedResolutionException;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.el.EL;
+import org.jboss.weld.util.collections.EnumerationList;
+
+
+public class Utils
+{
+
+   /**
+    * Checks if all annotations are in a given set of annotations
+    * 
+    * @param annotations The annotation set
+    * @param annotationTypes The annotations to match
+    * @return True if match, false otherwise
+    */
+   public static boolean annotationSetMatches(Set<? extends Annotation> annotations, Class<? extends Annotation>... annotationTypes)
+   {
+      List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
+      annotationTypeList.addAll(Arrays.asList(annotationTypes));
+      for (Annotation annotation : annotations)
+      {
+         if (annotationTypeList.contains(annotation.annotationType()))
+         {
+            annotationTypeList.remove(annotation.annotationType());
+         }
+         else
+         {
+            return false;
+         }
+      }
+      return annotationTypeList.size() == 0;
+   }
+
+   public static boolean typeSetMatches(Set<Type> types, Type... requiredTypes)
+   {
+      List<Type> typeList = Arrays.asList(requiredTypes);
+      return requiredTypes.length == types.size() && types.containsAll(typeList);
+   }
+
+   public static Iterable<URL> getResources(Class<?> clazz, String name)
+   {
+      if (name.startsWith("/"))
+      {
+         name = name.substring(1);
+      }
+      else
+      {
+         name = clazz.getPackage().getName().replace(".", "/") + "/" + name;
+      }
+      try
+      {
+         return new EnumerationList<URL>(clazz.getClassLoader().getResources(name));
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException("Error loading resource from classloader" + name, e);
+      }
+   }
+
+   public static byte[] serialize(Object instance) throws IOException
+   {
+      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+      ObjectOutputStream out = new ObjectOutputStream(bytes);
+      out.writeObject(instance);
+      return bytes.toByteArray();
+   }
+
+   public static <T> T deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+   {
+      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
+      return (T) in.readObject();
+   }
+
+   public static boolean isExceptionInHierarchy(Throwable exception, Class<? extends Throwable> expectedException )
+   {
+      while (exception != null)
+      {
+         if (exception.getClass().equals(expectedException))
+         {
+            return true;
+         }
+         exception = exception.getCause();
+      }
+      return false;
+   }
+   
+   public static <T> Bean<T> getBean(BeanManagerImpl beanManager, Type beanType, Annotation... bindings)
+   {
+      Set<Bean<?>> beans = beanManager.getBeans(beanType, bindings);
+      Bean<?> bean = beanManager.resolve(beans);
+      if (bean == null)
+      {
+         throw new UnsatisfiedResolutionException(UNRESOLVABLE_TYPE, beanType, Arrays.toString(bindings)); 
+      }
+      
+      @SuppressWarnings("unchecked")
+      Bean<T> typedBean = (Bean<T>) bean;
+      
+      return typedBean;
+   }
+
+   @SuppressWarnings("unchecked")
+   public static <T> Set<Bean<T>> getBeans(BeanManagerImpl beanManager, Class<T> type, Annotation... bindings)
+   {
+      return (Set) beanManager.getBeans(type, bindings);
+   }
+
+   @SuppressWarnings("unchecked")
+   public static <T> Set<Bean<T>> getBeans(BeanManagerImpl beanManager, TypeLiteral<T> type, Annotation... bindings)
+   {
+      return (Set) beanManager.getBeans(type.getType(), bindings);
+   }
+
+   @SuppressWarnings("unchecked")
+   public static <T> T getReference(BeanManagerImpl beanManager, Class<T> beanType, Annotation... bindings)
+   {
+      Bean<?> bean = getBean(beanManager, beanType, bindings);
+      return (T) beanManager.getReference(bean, beanType, beanManager.createCreationalContext(bean));
+   }
+   
+   @SuppressWarnings("unchecked")
+   public static <T> T getReference(BeanManagerImpl beanManager, Bean<T> bean)
+   {
+      return (T) beanManager.getReference(bean, bean.getBeanClass(), beanManager.createCreationalContext(bean));
+   }
+
+   @SuppressWarnings("unchecked")
+   public static <T> T evaluateValueExpression(BeanManagerImpl beanManager, String expression, Class<T> expectedType)
+   {
+      ELContext elContext = EL.createELContext(beanManager.getCurrent());
+      return (T) EL.EXPRESSION_FACTORY.createValueExpression(elContext, expression, expectedType).getValue(elContext);
+   }
+
+   public static boolean isProxy(Object proxy)
+   {
+      return proxy instanceof Proxy;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,365 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.bean.ForwardingBean;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.util.collections.Arrays2;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * Spec version: 20090519
+ * 
+ */
+ at RunWith(Arquillian.class)
+public class ActivitiesTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ActivitiesTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   private static final Set<Annotation> DEFAULT_QUALIFIERS = Collections.<Annotation> singleton(DefaultLiteral.INSTANCE);
+
+   private Bean<?> createDummyBean(BeanManager beanManager, final Type injectionPointType)
+   {
+      final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+      final Set<Type> types = new HashSet<Type>();
+      final Set<Annotation> bindings = new HashSet<Annotation>();
+      bindings.add(new AnnotationLiteral<Tame>()
+      {
+      });
+      types.add(Object.class);
+      final Bean<?> bean = new Bean<Object>()
+      {
+
+         public Set<Annotation> getQualifiers()
+         {
+            return bindings;
+         }
+
+         public Set<InjectionPoint> getInjectionPoints()
+         {
+            return injectionPoints;
+         }
+
+         public String getName()
+         {
+            return null;
+         }
+
+         public Class<? extends Annotation> getScope()
+         {
+            return Dependent.class;
+         }
+
+         public Set<Type> getTypes()
+         {
+            return types;
+         }
+
+         public boolean isNullable()
+         {
+            return false;
+         }
+
+         public Object create(CreationalContext<Object> creationalContext)
+         {
+            return null;
+         }
+
+         public void destroy(Object instance, CreationalContext<Object> creationalContext)
+         {
+
+         }
+
+         public Class<?> getBeanClass()
+         {
+            return Object.class;
+         }
+
+         public boolean isAlternative()
+         {
+            return false;
+         }
+
+         public Set<Class<? extends Annotation>> getStereotypes()
+         {
+            return Collections.emptySet();
+         }
+
+      };
+      InjectionPoint injectionPoint = new InjectionPoint()
+      {
+
+         public Bean<?> getBean()
+         {
+            return bean;
+         }
+
+         public Set<Annotation> getQualifiers()
+         {
+            return DEFAULT_QUALIFIERS;
+         }
+
+         public Member getMember()
+         {
+            return null;
+         }
+
+         public Type getType()
+         {
+            return injectionPointType;
+         }
+
+         public Annotated getAnnotated()
+         {
+            return null;
+         }
+
+         public boolean isDelegate()
+         {
+            return false;
+         }
+
+         public boolean isTransient()
+         {
+            return false;
+         }
+
+      };
+      injectionPoints.add(injectionPoint);
+      return bean;
+   }
+
+   private static class DummyContext implements Context
+   {
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return false;
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testBeanBelongingToParentActivityBelongsToChildActivity()
+   {
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      Contextual<?> bean = beanManager.getBeans(Cow.class).iterator().next();
+      BeanManager childActivity = beanManager.createActivity();
+      Assert.assertEquals(1, childActivity.getBeans(Cow.class).size());
+      Assert.assertEquals(bean, childActivity.getBeans(Cow.class).iterator().next());
+   }
+
+   @Test
+   public void testBeanBelongingToParentActivityCanBeInjectedIntoChildActivityBean()
+   {
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
+      childActivity.addBean(dummyBean);
+      Assert.assertNotNull(
+            childActivity.getInjectableReference(
+                  dummyBean.getInjectionPoints().iterator().next(), 
+                  childActivity.createCreationalContext(dummyBean)));
+   }
+
+   @Test
+   public void testObserverBelongingToParentActivityBelongsToChildActivity()
+   {
+      Assert.assertEquals(1, beanManager.resolveObserverMethods(new NightTime()).size());
+      ObserverMethod<?> observer = beanManager.resolveObserverMethods(new NightTime()).iterator().next();
+      BeanManager childActivity = beanManager.createActivity();
+      Assert.assertEquals(1, childActivity.resolveObserverMethods(new NightTime()).size());
+      Assert.assertEquals(observer, childActivity.resolveObserverMethods(new NightTime()).iterator().next());
+   }
+
+   @Test
+   public void testObserverBelongingToParentFiresForChildActivity()
+   {
+      Fox.setObserved(false);
+      BeanManager childActivity = beanManager.createActivity();
+      childActivity.fireEvent(new NightTime());
+      Assert.assertTrue(Fox.isObserved());
+   }
+
+   @Test
+   public void testContextObjectBelongingToParentBelongsToChild()
+   {
+      Context context = new DummyContext()
+      {
+
+         @Override
+         public boolean isActive()
+         {
+            return true;
+         }
+
+      };
+      beanManager.addContext(context);
+      BeanManager childActivity = beanManager.createActivity();
+      Assert.assertNotNull(childActivity.getContext(Dummy.class));
+   }
+
+   @Test
+   public void testBeanBelongingToChildActivityCannotBeInjectedIntoParentActivityBean()
+   {
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
+      childActivity.addBean(dummyBean);
+      Assert.assertEquals(0, beanManager.getBeans(Object.class, new AnnotationLiteral<Tame>()
+      {
+      }).size());
+   }
+
+   @Test(expected = UnsatisfiedResolutionException.class)
+   public void testInstanceProcessedByParentActivity()
+   {
+      Context dummyContext = new DummyContext();
+      beanManager.addContext(dummyContext);
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      final Bean<Cow> bean = (Bean<Cow>)beanManager.getBeans(Cow.class).iterator().next();
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      final Set<Annotation> bindingTypes = new HashSet<Annotation>();
+      bindingTypes.add(new AnnotationLiteral<Tame>()
+      {
+      });
+      childActivity.addBean(new ForwardingBean<Cow>()
+      {
+
+         @Override
+         protected Bean<Cow> delegate()
+         {
+            return bean;
+         }
+
+         @Override
+         public Set<Annotation> getQualifiers()
+         {
+            return bindingTypes;
+         }
+
+         @Override
+         public Set<Class<? extends Annotation>> getStereotypes()
+         {
+            return Collections.emptySet();
+         }
+
+      });
+      Utils.getReference(beanManager, Field.class).get();
+   }
+
+   @Test
+   public void testObserverBelongingToChildDoesNotFireForParentActivity()
+   {
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      ObserverMethod<NightTime> observer = new ObserverMethod<NightTime>()
+      {
+
+         public void notify(NightTime event)
+         {
+            assert false;
+         }
+
+         public Class<?> getBeanClass()
+         {
+            return NightTime.class;
+         }
+
+         public Set<Annotation> getObservedQualifiers()
+         {
+            return Arrays2.asSet(AnyLiteral.INSTANCE, DefaultLiteral.INSTANCE);
+         }
+
+         public Type getObservedType()
+         {
+            return NightTime.class;
+         }
+
+         public Reception getReception()
+         {
+            return Reception.ALWAYS;
+         }
+
+         public TransactionPhase getTransactionPhase()
+         {
+            return TransactionPhase.IN_PROGRESS;
+         }
+
+      };
+      // TODO Fix this test to use an observer method in a child activity
+      childActivity.addObserver(observer);
+      beanManager.fireEvent(new NightTime());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities;
+
+class Cow
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities;
+
+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.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Scope;
+
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Scope
+ at Inherited
+ at interface Dummy {}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+class Field
+{
+   
+   @Inject @Tame Instance<Cow> instance;
+   
+   public Cow get()
+   {
+      return instance.get();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities;
+
+import javax.enterprise.event.Observes;
+
+class Fox
+{
+   
+   private static boolean observed = false;
+   
+   public void observe(@Observes NightTime nighttime)
+   {
+      observed = true;
+   }
+   
+   public static boolean isObserved()
+   {
+      return observed;
+   }
+   
+   public static void setObserved(boolean observed)
+   {
+      Fox.observed = observed;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities;
+
+class NightTime
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Tame
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/BeanWithInjection.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/BeanWithInjection.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/BeanWithInjection.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.child;
+
+class BeanWithInjection
+{
+   @SpecialBindingType
+   protected MyBean myBean;
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/MyBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/MyBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/MyBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.child;
+
+ at SpecialBindingType
+class MyBean
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.child;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.InjectionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * Spec version: 20090519
+ *
+ */
+ at RunWith(Arquillian.class)
+public class SameBeanTypeInChildActivityTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(SameBeanTypeInChildActivityTest.class.getPackage());
+   }
+
+   private static final Set<Annotation> DEFAULT_QUALIFIERS = Collections.<Annotation>singleton(DefaultLiteral.INSTANCE);
+
+   private Bean<?> createDummyBean(BeanManager beanManager)
+   {
+      final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+      final Set<Type> types = new HashSet<Type>();
+      final Set<Annotation> bindings = new HashSet<Annotation>();
+      bindings.add(new AnnotationLiteral<SpecialBindingType>() {});
+      types.add(Object.class);
+      final Bean<?> bean = new Bean<MyBean>()
+      {
+
+         public Set<Annotation> getQualifiers()
+         {
+            return bindings;
+         }
+
+         public Set<InjectionPoint> getInjectionPoints()
+         {
+            return injectionPoints;
+         }
+
+         public String getName()
+         {
+            return null;
+         }
+
+         public Class<? extends Annotation> getScope()
+         {
+            return Dependent.class;
+         }
+
+         public Set<Type> getTypes()
+         {
+            return types;
+         }
+
+         public boolean isNullable()
+         {
+            return false;
+         }
+
+         public MyBean create(CreationalContext<MyBean> creationalContext)
+         {
+            return null;
+         }
+
+         public void destroy(MyBean instance, CreationalContext<MyBean> creationalContext)
+         {
+
+         }
+
+         public Class<?> getBeanClass()
+         {
+            return MyBean.class;
+         }
+
+         public boolean isAlternative()
+         {
+            return false;
+         }
+
+         public Set<Class<? extends Annotation>> getStereotypes()
+         {
+            return Collections.emptySet();
+         }
+
+      };
+      return bean;
+   }
+
+   @Inject 
+   private BeanManagerImpl beanManager;
+   
+   @Test(expected = InjectionException.class)
+   @Category(Broken.class)
+   public void testSameBeanTypeInChildAsParentInjection()
+   {
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      Bean<?> anotherMyBean = createDummyBean(childActivity);
+      childActivity.addBean(anotherMyBean);
+   }
+
+   @Test(expected = InjectionException.class)
+   @Category(Broken.class)
+   public void testSameBeanTypeInChildAsIndirectParentInjection()
+   {
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      BeanManagerImpl grandChildActivity = childActivity.createActivity();
+      Bean<?> anotherMyBean = createDummyBean(grandChildActivity);
+      grandChildActivity.addBean(anotherMyBean);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SpecialBindingType.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SpecialBindingType.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SpecialBindingType.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.child;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Retention(RUNTIME)
+ at Target({TYPE, METHOD, FIELD, PARAMETER})
+ at Qualifier
+ at interface SpecialBindingType
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Cow.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Cow.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Cow.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+class Cow
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Donkey.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Donkey.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Donkey.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+class Donkey
+{
+   
+   BeanManager beanManager;
+   
+   public Donkey() throws NamingException
+   {
+      beanManager = (BeanManager) new InitialContext().lookup("java:comp/BeanManager");
+   }
+   
+   public BeanManager getManager()
+   {
+      return beanManager;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dummy.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dummy.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dummy.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+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.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.NormalScope;
+
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at NormalScope
+ at Inherited
+ at interface Dummy {}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dusk.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dusk.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Dusk.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+class Dusk
+{
+   
+   @Inject
+   public Dusk(@Any Event<NightTime> event)
+   {
+      event.fire(new NightTime());
+   }
+   
+   public void ping() {}
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,194 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.el.EL;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.sun.el.ExpressionFactoryImpl;
+
+/**
+ * 
+ * Spec version: 20090519
+ *
+ */
+ at RunWith(Arquillian.class)
+public class ELCurrentActivityTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ELCurrentActivityTest.class.getPackage())
+         .addClasses(Utils.class, EL.class)
+         .addPackages(true, ExpressionFactoryImpl.class.getPackage());
+   }
+
+   private static class DummyContext implements Context
+   {
+      private boolean active = true;
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return active;
+      }
+
+      public void setActive(boolean active)
+      {
+         this.active = active;
+      }
+
+   }
+
+   private static class Daisy implements Bean<Cow>
+   {
+
+      private static final Set<Type> TYPES = new HashSet<Type>();
+
+      private final static Set<Annotation> BINDING_TYPES = new HashSet<Annotation>();
+
+
+      static
+      {
+         TYPES.add(Cow.class);
+         TYPES.add(Object.class);
+         BINDING_TYPES.add(new AnnotationLiteral<Tame>() {});
+      }
+
+      public Daisy(BeanManager beanManager)
+      {
+      }
+
+      public Set<Annotation> getQualifiers()
+      {
+         return BINDING_TYPES;
+      }
+
+      public Set<InjectionPoint> getInjectionPoints()
+      {
+         return Collections.emptySet();
+      }
+
+      public String getName()
+      {
+         return "daisy";
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dependent.class;
+      }
+
+      public Set<Type> getTypes()
+      {
+         return TYPES;
+      }
+
+      public boolean isNullable()
+      {
+         return true;
+      }
+
+      public boolean isSerializable()
+      {
+         return false;
+      }
+
+      public Cow create(CreationalContext<Cow> creationalContext)
+      {
+         return new Cow();
+      }
+
+      public void destroy(Cow instance, CreationalContext<Cow> creationalContext)
+      {
+         // TODO Auto-generated method stub
+
+      }
+
+      public Class<?> getBeanClass()
+      {
+         return Cow.class;
+      }
+
+      public boolean isAlternative()
+      {
+         return false;
+      }
+
+      public Set<Class<? extends Annotation>> getStereotypes()
+      {
+         return Collections.emptySet();
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testELEvaluationProcessedByCurrentActivty()
+   {
+      Context dummyContext = new DummyContext();
+      beanManager.addContext(dummyContext);
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      childActivity.addBean(new Daisy(childActivity));
+      childActivity.setCurrent(dummyContext.getScope());
+      Assert.assertNotNull(Utils.evaluateValueExpression(beanManager, "#{daisy}", Cow.class));
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * Spec version: 20090519
+ * 
+ */
+ at RunWith(Arquillian.class)
+public class EventCurrentActivityTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(EventCurrentActivityTest.class.getPackage())
+         .addClasses(Utils.class);
+   }
+
+   private static class DummyContext implements Context
+   {
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return true;
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   @Category(Broken.class)
+   public void testEventProcessedByCurrentActivity()
+   {
+      DummyContext dummyContext = new DummyContext();
+      beanManager.addContext(dummyContext);
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      TestableObserverMethod<NightTime> observer = new TestableObserverMethod<NightTime>()
+      {
+
+         boolean observed = false;
+
+         public void notify(NightTime event)
+         {
+            observed = true;
+         }
+
+         public boolean isObserved()
+         {
+            return observed;
+         }
+
+         public Class<?> getBeanClass()
+         {
+            return NightTime.class;
+         }
+
+         public Set<Annotation> getObservedQualifiers()
+         {
+            return Collections.<Annotation>singleton(AnyLiteral.INSTANCE);
+         }
+
+         public Type getObservedType()
+         {
+            return NightTime.class;
+         }
+
+         public Reception getReception()
+         {
+            return Reception.ALWAYS;
+         }
+
+         public TransactionPhase getTransactionPhase()
+         {
+            return TransactionPhase.IN_PROGRESS;
+         }
+         
+      };
+      childActivity.addObserver(observer);
+      childActivity.setCurrent(dummyContext.getScope());
+      Utils.getReference(beanManager, Dusk.class).ping();
+      Assert.assertTrue(observer.isObserved());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Field.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Field.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Field.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+class Field
+{
+   
+   @Inject @Tame Instance<Cow> instance;
+   
+   public Cow get()
+   {
+      return instance.get();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Horse.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Horse.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Horse.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+class Horse
+{
+   
+   @Inject BeanManager beanManager;
+   
+   public BeanManager getManager()
+   {
+      return beanManager;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.manager.api.WeldManager;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * Spec version: 20090519
+ *
+ */
+ at RunWith(Arquillian.class)
+public class InactiveScopeTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(InactiveScopeTest.class.getPackage());
+   }
+
+   private static class DummyContext implements Context
+   {
+
+      private boolean active = true;
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return active;
+      }
+
+      public void setActive(boolean active)
+      {
+         this.active = active;
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test(expected = ContextNotActiveException.class)
+   public void testInactiveScope()
+   {
+      DummyContext dummyContext = new DummyContext();
+      dummyContext.setActive(false);
+      beanManager.addContext(dummyContext);
+      WeldManager childActivity = beanManager.createActivity();
+      childActivity.setCurrent(dummyContext.getScope());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * Spec version: 20090519
+ *
+ */
+ at RunWith(Arquillian.class)
+public class InjectedManagerCurrentActivityTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(InjectedManagerCurrentActivityTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   private static class DummyContext implements Context
+   {
+
+      private boolean active = true;
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return active;
+      }
+
+      public void setActive(boolean active)
+      {
+         this.active = active;
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void testInjectedManagerIsCurrentActivity()
+   {
+      Context dummyContext = new DummyContext();
+      beanManager.addContext(dummyContext);
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      WeldManager childActivity = beanManager.createActivity();
+      childActivity.setCurrent(dummyContext.getScope());
+      Assert.assertEquals(childActivity, Utils.getReference(beanManager, Horse.class).getManager());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * Spec version: 20090519
+ *
+ */
+ at RunWith(Arquillian.class)
+public class InstanceCurrentActivityTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(InstanceCurrentActivityTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   public static class TameLiteral extends AnnotationLiteral<Tame> implements Tame {}
+
+   private static class DummyContext implements Context
+   {
+
+      private boolean active = true;
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return active;
+      }
+
+      public void setActive(boolean active)
+      {
+         this.active = active;
+      }
+
+   }
+
+   private static class NonNormalContext extends DummyContext
+   {
+
+      @Override
+      public Class<? extends Annotation> getScope()
+      {
+         return NonNormalScope.class;
+      }
+
+   }
+
+   private static class Daisy implements Bean<Cow>
+   {
+
+      private static final Set<Type> TYPES = new HashSet<Type>();
+
+      private final static Set<Annotation> BINDING_TYPES = new HashSet<Annotation>();
+
+
+      static
+      {
+         TYPES.add(Cow.class);
+         TYPES.add(Object.class);
+         BINDING_TYPES.add(new TameLiteral());
+      }
+
+      public Daisy(BeanManager beanManager)
+      {
+      }
+
+      public Set<Annotation> getQualifiers()
+      {
+         return BINDING_TYPES;
+      }
+
+      public Set<InjectionPoint> getInjectionPoints()
+      {
+         return Collections.emptySet();
+      }
+
+      public String getName()
+      {
+         return "daisy";
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dependent.class;
+      }
+
+      public Set<Type> getTypes()
+      {
+         return TYPES;
+      }
+
+      public boolean isNullable()
+      {
+         return true;
+      }
+
+      public Cow create(CreationalContext<Cow> creationalContext)
+      {
+         return new Cow();
+      }
+
+      public void destroy(Cow instance, CreationalContext<Cow> creationalContext)
+      {
+         // TODO Auto-generated method stub
+
+      }
+
+      public Class<?> getBeanClass()
+      {
+         return Cow.class;
+      }
+
+      public boolean isAlternative()
+      {
+         return false;
+      }
+
+      public Set<Class<? extends Annotation>> getStereotypes()
+      {
+         return Collections.emptySet();
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void testInstanceProcessedByCurrentActivity()
+   {
+      Context dummyContext = new DummyContext();
+      beanManager.addContext(dummyContext);
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      BeanManagerImpl childActivity = beanManager.createActivity();
+      childActivity.addBean(new Daisy(childActivity));
+      childActivity.setCurrent(dummyContext.getScope());
+      Assert.assertNotNull(Utils.getReference(beanManager, Field.class).get());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * Spec version: 20090519
+ *
+ */
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class JndiManagerCurrentActivityTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(JndiManagerCurrentActivityTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   private static class DummyContext implements Context
+   {
+
+      private boolean active = true;
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return active;
+      }
+
+      public void setActive(boolean active)
+      {
+         this.active = active;
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void testJndiManagerIsCurrentActivity()
+   {
+      Context dummyContext = new DummyContext();
+      beanManager.addContext(dummyContext);
+      Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+      WeldManager childActivity = beanManager.createActivity();
+      childActivity.setCurrent(dummyContext.getScope());
+      Assert.assertEquals(childActivity, Utils.getReference(beanManager, Donkey.class).getManager());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NightTime.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NightTime.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NightTime.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+class NightTime
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScope.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScope.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScope.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+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.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Scope;
+
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Scope
+ at Inherited
+ at interface NonNormalScope {}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.manager.api.WeldManager;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class NonNormalScopeTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(NonNormalScopeTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   private static class DummyContext implements Context
+   {
+
+      private boolean active = true;
+
+      public <T> T get(Contextual<T> contextual)
+      {
+         return null;
+      }
+
+      public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isActive()
+      {
+         return active;
+      }
+
+      public void setActive(boolean active)
+      {
+         this.active = active;
+      }
+
+   }
+
+   private static class NonNormalContext extends DummyContext
+   {
+
+      @Override
+      public Class<? extends Annotation> getScope()
+      {
+         return NonNormalScope.class;
+      }
+
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test(expected = IllegalArgumentException.class)
+   public void testNonNormalScope()
+   {
+      Context dummyContext = new NonNormalContext();
+      beanManager.addContext(dummyContext);
+      WeldManager childActivity = beanManager.createActivity();
+      childActivity.setCurrent(dummyContext.getScope());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Tame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Tame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/Tame.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Tame
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/TestableObserverMethod.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/TestableObserverMethod.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/TestableObserverMethod.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.activities.current;
+
+import javax.enterprise.inject.spi.ObserverMethod;
+
+public interface TestableObserverMethod<T> extends ObserverMethod<T>
+{
+   
+   public boolean isObserved();
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Animal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Animal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Animal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+interface Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BootstrapTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(BootstrapTest.class.getPackage());
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testMultipleSimpleBean()
+   {
+      List<Bean<?>> beans = beanManager.getBeans();
+      Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof RIBean)
+         {
+            classes.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(classes.containsKey(Tuna.class));
+      Assert.assertTrue(classes.containsKey(Salmon.class));
+      Assert.assertTrue(classes.containsKey(SeaBass.class));
+      Assert.assertTrue(classes.containsKey(Sole.class));
+      
+      Assert.assertTrue(classes.get(Tuna.class) instanceof ManagedBean);
+      Assert.assertTrue(classes.get(Salmon.class) instanceof ManagedBean);
+      Assert.assertTrue(classes.get(SeaBass.class) instanceof ManagedBean);
+      Assert.assertTrue(classes.get(Sole.class) instanceof ManagedBean);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Salmon.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Salmon.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Salmon.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+import javax.inject.Named;
+
+ at Named
+class Salmon implements ScottishFish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/ScottishFish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/ScottishFish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/ScottishFish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+interface ScottishFish extends Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/SeaBass.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/SeaBass.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/SeaBass.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class SeaBass implements Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Sole.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Sole.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Sole.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+import javax.inject.Named;
+
+ at Whitefish
+ at Named("whitefish")
+class Sole implements ScottishFish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Tuna.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Tuna.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Tuna.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class Tuna
+{
+   
+   public String getName()
+   {
+      return "Ophir";
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Whitefish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Whitefish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/Whitefish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.multiple;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Whitefish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.single;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BootstrapTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(BootstrapTest.class.getPackage());
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testSingleSimpleBean()
+   {
+      List<Bean<?>> beans = beanManager.getBeans();
+      Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof RIBean)
+         {
+            classes.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(classes.containsKey(Tuna.class));
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/Tuna.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/Tuna.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/Tuna.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.managed.single;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class Tuna
+{
+   
+   public String getName()
+   {
+      return "Ophir";
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Animal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Animal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Animal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+interface Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BootstrapTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(BootstrapTest.class.getPackage())
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void testMultipleEnterpriseAndSimpleBean()
+   {
+      List<Bean<?>> beans = beanManager.getBeans();
+      Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof RIBean)
+         {
+            classes.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(classes.containsKey(Hound.class));
+      Assert.assertTrue(classes.containsKey(Elephant.class));
+      Assert.assertTrue(classes.containsKey(Panther.class));
+      Assert.assertTrue(classes.containsKey(Tiger.class));
+      Assert.assertTrue(classes.containsKey(Tuna.class));
+      Assert.assertTrue(classes.containsKey(Salmon.class));
+      Assert.assertTrue(classes.containsKey(SeaBass.class));
+      Assert.assertTrue(classes.containsKey(Sole.class));
+      
+      Assert.assertTrue(classes.get(Hound.class) instanceof SessionBean);
+      Assert.assertTrue(classes.get(Elephant.class) instanceof SessionBean);
+      Assert.assertTrue(classes.get(Panther.class) instanceof SessionBean);
+      Assert.assertTrue(classes.get(Tiger.class) instanceof SessionBean);
+      Assert.assertTrue(classes.get(Tuna.class) instanceof ManagedBean);
+      Assert.assertTrue(classes.get(Salmon.class) instanceof ManagedBean);
+      Assert.assertTrue(classes.get(SeaBass.class) instanceof ManagedBean);
+      Assert.assertTrue(classes.get(Sole.class) instanceof ManagedBean);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Elephant.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Elephant.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Elephant.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+ at Stateful
+class Elephant implements ElephantLocal
+{
+   
+   @Remove
+   public void remove1()
+   {
+      
+   }
+   
+   @Remove
+   public void remove2()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ElephantLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ElephantLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ElephantLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.ejb.Local;
+
+ at Local
+public interface ElephantLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Hound.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Hound.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Hound.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Named;
+
+ at Stateful
+ at Tame
+ at Named("Pongo")
+class Hound implements HoundLocal
+{ 
+   @Remove
+   public void bye() {
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/HoundLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/HoundLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/HoundLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.ejb.Local;
+
+ at Local
+public interface HoundLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Panther.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Panther.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Panther.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+ at Stateful
+class Panther implements PantherLocal
+{
+   
+   @Remove
+   public void remove(String foo)
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/PantherLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/PantherLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/PantherLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+public interface PantherLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Salmon.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Salmon.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Salmon.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.inject.Named;
+
+ at Named
+class Salmon implements ScottishFish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ScottishFish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ScottishFish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/ScottishFish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+interface ScottishFish extends Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/SeaBass.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/SeaBass.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/SeaBass.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class SeaBass implements Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Sole.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Sole.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Sole.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.inject.Named;
+
+ at Whitefish
+ at Named("whitefish")
+class Sole implements ScottishFish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Synchronous.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Synchronous.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Synchronous.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Synchronous
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tame.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Tame
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tiger.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tiger.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tiger.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+ at Stateful
+ at Synchronous
+public class Tiger implements TigerLocal
+{
+   
+   @Remove
+   public void remove()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/TigerLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/TigerLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/TigerLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.ejb.Local;
+
+ at Local
+public interface TigerLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tuna.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tuna.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Tuna.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class Tuna
+{
+   
+   public String getName()
+   {
+      return "Ophir";
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Whitefish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Whitefish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/Whitefish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.mixed;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Whitefish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Animal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Animal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Animal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+interface Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.bean.ProducerMethod;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BootstrapTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(BootstrapTest.class.getPackage())
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void testProducerMethodBean()
+   {
+      //deployBeans(TarantulaProducer.class);
+      List<Bean<?>> beans = beanManager.getBeans();
+      Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof RIBean<?>)
+         {
+            classes.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(classes.containsKey(TarantulaProducer.class));
+      Assert.assertTrue(classes.containsKey(Tarantula.class));
+      
+      Assert.assertTrue(classes.get(TarantulaProducer.class) instanceof ManagedBean<?>);
+      Assert.assertTrue(classes.get(Tarantula.class) instanceof ProducerMethod<?, ?>);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlyAnimal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlyAnimal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlyAnimal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+interface DeadlyAnimal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlySpider.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlySpider.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DeadlySpider.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+interface DeadlySpider extends DeadlyAnimal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DefangedTarantula.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DefangedTarantula.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/DefangedTarantula.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+class DefangedTarantula extends Tarantula
+{
+   
+   public DefangedTarantula()
+   {
+      super("defanged");
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Spider.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Spider.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Spider.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+class Spider implements Animal
+{
+
+   public final void layEggs()
+   {
+      
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tame.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Tame
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tarantula.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tarantula.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/Tarantula.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+
+
+class Tarantula extends Spider implements DeadlySpider
+{
+   
+   public Tarantula(String foo)
+   {
+      // TODO Auto-generated constructor stub
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/TarantulaProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/TarantulaProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/TarantulaProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.producers.singleProducerMethod;
+
+import javax.enterprise.inject.Produces;
+
+public class TarantulaProducer
+{
+   
+   @Produces @Tame public Tarantula produceTameTarantula()
+   {
+      return new DefangedTarantula();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BootstrapTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(BootstrapTest.class.getPackage())
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testMultipleEnterpriseBean()
+   {
+      List<Bean<?>> beans = beanManager.getBeans();
+      Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof RIBean)
+         {
+            classes.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(classes.containsKey(Hound.class));
+      Assert.assertTrue(classes.containsKey(Elephant.class));
+      Assert.assertTrue(classes.containsKey(Panther.class));
+      Assert.assertTrue(classes.containsKey(Tiger.class));
+      
+      Assert.assertTrue(classes.get(Hound.class) instanceof SessionBean);
+      Assert.assertTrue(classes.get(Elephant.class) instanceof SessionBean);
+      Assert.assertTrue(classes.get(Panther.class) instanceof SessionBean);
+      Assert.assertTrue(classes.get(Tiger.class) instanceof SessionBean);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Elephant.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Elephant.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Elephant.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+ at Stateful
+class Elephant implements ElephantLocal
+{
+   
+   @Remove
+   public void remove1()
+   {
+      
+   }
+   
+   @Remove
+   public void remove2()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/ElephantLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/ElephantLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/ElephantLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import javax.ejb.Local;
+
+ at Local
+public interface ElephantLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Hound.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Hound.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Hound.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Named;
+
+ at Stateful
+ at Tame
+ at Named("Pongo")
+class Hound implements HoundLocal
+{ 
+   @Remove
+   public void bye() {
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/HoundLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/HoundLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/HoundLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import javax.ejb.Local;
+
+ at Local
+public interface HoundLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Panther.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Panther.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Panther.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+ at Stateful
+class Panther implements PantherLocal
+{
+   
+   @Remove
+   public void remove(String foo)
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/PantherLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/PantherLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/PantherLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+public interface PantherLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Synchronous.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Synchronous.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Synchronous.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Synchronous
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tame.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Tame
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tiger.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tiger.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/Tiger.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+ at Stateful
+ at Synchronous
+public class Tiger implements TigerLocal
+{
+   
+   @Remove
+   public void remove()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/TigerLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/TigerLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/TigerLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.multiple;
+
+import javax.ejb.Local;
+
+ at Local
+public interface TigerLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.single;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BootstrapTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(BeanArchive.class)
+                  .addPackage(BootstrapTest.class.getPackage())
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testSingleEnterpriseBean()
+   {
+      List<Bean<?>> beans = beanManager.getBeans();
+      Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof RIBean)
+         {
+            classes.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(classes.containsKey(Hound.class));
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Hound.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Hound.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Hound.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.single;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Named;
+
+ at Stateful
+ at Tame
+ at Named("Pongo")
+class Hound implements HoundLocal
+{ 
+   @Remove
+   public void bye() {
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/HoundLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/HoundLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/HoundLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.single;
+
+import javax.ejb.Local;
+
+ at Local
+public interface HoundLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Tame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Tame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/Tame.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanDeployment.session.single;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Tame
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,53 @@
+package org.jboss.weld.tests.beanManager;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BeanManagerTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(BeanManagerTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test(expected=IllegalArgumentException.class)
+   public void testNullBeanArgumentToGetReference()
+   {
+      Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+      CreationalContext<Foo> cc = beanManager.createCreationalContext(bean);
+      beanManager.getReference(null, Foo.class, cc);
+   }
+   
+   @Test(expected=IllegalArgumentException.class)
+   public void testNullBeanTypeArgumentToGetReference()
+   {
+      Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+      CreationalContext<Foo> cc = beanManager.createCreationalContext(bean);
+      beanManager.getReference(bean, null, cc);
+   }
+   
+   @Test(expected=IllegalArgumentException.class)
+   public void testNullCreationalContextArgumentToGetReference()
+   {
+      Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+      beanManager.getReference(bean, Foo.class, null);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,6 @@
+package org.jboss.weld.tests.beanManager;
+
+public class Foo
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanManager.annotation;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagerAnnotationTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class);
+   }
+
+   @Inject 
+   private BeanManager beanManager;
+   
+   /*
+    * description="WELD-299"
+    */
+   @Test
+   public void testIsQualifier() throws Exception
+   {
+      Assert.assertFalse(beanManager.isQualifier(PersistenceContext.class));
+   }
+   
+   /*
+    * description="WELD-299"
+    */
+   @Test
+   public void testIsInterceptorBinding() throws Exception
+   {
+      Assert.assertFalse(beanManager.isInterceptorBinding(PersistenceContext.class));
+   }
+   
+   /*
+    * description="WELD-299"
+    */
+   @Test
+   public void testIsNormalScope() throws Exception
+   {
+      Assert.assertFalse(beanManager.isNormalScope(PersistenceContext.class));
+   }
+   
+   /*
+    * description="WELD-299"
+    */
+   @Test
+   public void testIsPassivatingScope() throws Exception
+   {
+      Assert.assertFalse(beanManager.isPassivatingScope(PersistenceContext.class));
+   }
+   
+   /*
+    * description="WELD-299"
+    */
+   @Test
+   public void testIsScope() throws Exception
+   {
+      Assert.assertFalse(beanManager.isScope(PersistenceContext.class));
+   }
+   
+   /*
+    * description="WELD-299"
+    */
+   @Test
+   public void testIsStereotype() throws Exception
+   {
+      Assert.assertFalse(beanManager.isStereotype(PersistenceContext.class));
+   }
+   
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanManager.serializability;
+
+public class Foo
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.beanManager.serializability;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagerTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(WebArchive.class, "test.war")
+               .addPackage(ManagerTest.class.getPackage())
+               .addClass(Utils.class)
+               .addWebResource(EmptyAsset.INSTANCE, "beans.xml");
+   }
+   
+   private static final Set<Annotation> DEFAULT_QUALIFIERS = Collections.<Annotation>singleton(DefaultLiteral.INSTANCE);
+   
+   private static interface Dummy {}
+   
+   private static class DummyBean implements Bean<Dummy>
+   {
+      private static final Set<Type> TYPES = new HashSet<Type>();
+      
+      static
+      {
+         TYPES.add(Dummy.class);
+         TYPES.add(Object.class);
+      }
+
+      public Set<Annotation> getQualifiers()
+      {
+         return DEFAULT_QUALIFIERS;
+      }
+
+      public Set<InjectionPoint> getInjectionPoints()
+      {
+         return Collections.emptySet();
+      }
+
+      public String getName()
+      {
+         return null;
+      }
+
+      public Class<? extends Annotation> getScope()
+      {
+         return Dependent.class;
+      }
+
+      public Set<Type> getTypes()
+      {
+         return TYPES;
+      }
+
+      public boolean isNullable()
+      {
+         return true;
+      }
+
+      public Dummy create(CreationalContext<Dummy> creationalContext)
+      {
+         return null;
+      }
+
+      public void destroy(Dummy instance, CreationalContext<Dummy> creationalContext)
+      {
+         
+      }
+
+      public Class<?> getBeanClass()
+      {
+         return Dummy.class;
+      }
+
+      public boolean isAlternative()
+      {
+         return false;
+      }
+
+      public Set<Class<? extends Annotation>> getStereotypes()
+      {
+         return Collections.emptySet();
+      }
+      
+   }
+
+   @Inject 
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testRootManagerSerializability() throws Exception
+   {
+      String rootManagerId = beanManager.getId();
+      BeanManagerImpl deserializedRootManager = (BeanManagerImpl) Utils.deserialize(Utils.serialize(beanManager));
+      Assert.assertEquals(rootManagerId, deserializedRootManager.getId());
+      Assert.assertEquals(1, beanManager.getBeans(Foo.class).size());
+      Assert.assertEquals(1, deserializedRootManager.getBeans(Foo.class).size());
+      Assert.assertEquals(
+            deserializedRootManager.getBeans(Foo.class).iterator().next(), 
+            beanManager.getBeans(Foo.class).iterator().next());
+   }
+   
+   @Test
+   public void testChildManagerSerializability() throws Exception
+   {
+      BeanManagerImpl childManager = beanManager.createActivity();
+      Bean<?> dummyBean = new DummyBean();
+      childManager.addBean(dummyBean);
+      String childManagerId = childManager.getId();
+      BeanManagerImpl deserializedChildManager = (BeanManagerImpl) Utils.deserialize(Utils.serialize(childManager));
+      Assert.assertEquals(childManagerId, deserializedChildManager.getId());
+      Assert.assertEquals(1, childManager.getBeans(Dummy.class).size());
+      Assert.assertEquals(1, deserializedChildManager.getBeans(Dummy.class).size());
+      Assert.assertEquals(
+            deserializedChildManager.getBeans(Dummy.class).iterator().next(),
+            childManager.getBeans(Dummy.class).iterator().next());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import static org.jboss.weld.tests.builtinBeans.Checker.checkBeanManager;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkEquality;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkEvent;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkInjectionPoint;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkInstance;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkPrincipal;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkUserTransaction;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkValidator;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkValidatorFactory;
+
+import java.security.Principal;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.transaction.UserTransaction;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class BuiltInBeanPassivationCapableTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(BuiltInBeanPassivationCapableTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Test
+   public void testDefaultValidatorBean(Validator validator) throws Throwable
+   {
+      Validator validator1 = Utils.deserialize(Utils.serialize(validator));
+      Assert.assertTrue(checkValidator(validator1));
+   }
+
+   @Test
+   public void testDefaultValidatorFactoryBean(ValidatorFactory validatorFactory) throws Throwable
+   {
+      ValidatorFactory validatorFactory1 = Utils.deserialize(Utils.serialize(validatorFactory));
+      Assert.assertTrue(checkValidatorFactory(validatorFactory1));
+   }
+
+   @Test
+   @Category({Integration.class, Broken.class})
+   public void testPrincipal(Principal principal) throws Throwable
+   {
+      Principal principal1 = Utils.deserialize(Utils.serialize(principal));
+      Assert.assertTrue(checkPrincipal(principal1));
+   }
+
+   @Test
+   public void testUserTransactionBean(UserTransaction userTransaction) throws Throwable
+   {
+      UserTransaction userTransaction1 = Utils.deserialize(Utils.serialize(userTransaction));
+      Assert.assertTrue(checkUserTransaction(userTransaction1));
+   }
+   
+   @Test 
+   public void testBeanManagerBean(BeanManager beanManager) throws Throwable
+   {
+      BeanManager beanManager1 = Utils.deserialize(Utils.serialize(beanManager));
+      Assert.assertTrue(checkBeanManager(beanManager1));
+      Assert.assertTrue(checkEquality(beanManager, beanManager1));
+   }
+   
+   @Test
+   public void testInstance(Consumer consumer) throws Throwable
+   {
+      Instance<Cow> instance = consumer.getCow();
+      Instance<Cow> instance1 = Utils.deserialize(Utils.serialize(instance));
+      Assert.assertTrue(checkInstance(instance1));
+      Assert.assertTrue(checkEquality(instance, instance1));
+   }
+   
+   @Test
+   public void testEvent(Consumer consumer, CowEventObserver observer) throws Throwable
+   {
+      Event<Cow> event = consumer.getEvent();
+      Event<Cow> event1 = Utils.deserialize(Utils.serialize(event));
+      Assert.assertTrue(checkEvent(event1, observer));
+      Assert.assertTrue(checkEquality(event, event1));
+   }
+   
+   @Test
+   public void testFieldInjectionPoint(FieldInjectionPointConsumer consumer) throws Throwable
+   {
+      Dog.reset();
+      consumer.ping();
+      InjectionPoint injectionPoint = Dog.getInjectionPoint();
+      InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
+      Assert.assertTrue(checkInjectionPoint(injectionPoint1, FieldInjectionPointConsumer.class));
+      Assert.assertTrue(checkEquality(injectionPoint, injectionPoint1));
+   }
+   
+   @Test
+   public void testConstructorInjectionPoint(ConstructorInjectionPointConsumer consumer) throws Throwable
+   {
+      Dog.reset();
+      consumer.ping();
+      InjectionPoint injectionPoint = Dog.getInjectionPoint();
+      InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
+      Assert.assertTrue(checkInjectionPoint(injectionPoint1, ConstructorInjectionPointConsumer.class));
+      Assert.assertTrue(checkEquality(injectionPoint, injectionPoint1));
+   }
+   
+   @Test
+   public void testMethodInjectionPoint(MethodInjectionPointConsumer consumer) throws Throwable
+   {
+      Dog.reset();
+      consumer.ping();
+      InjectionPoint injectionPoint = Dog.getInjectionPoint();
+      InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
+      Assert.assertTrue(checkInjectionPoint(injectionPoint1, MethodInjectionPointConsumer.class));
+      Assert.assertTrue(checkEquality(injectionPoint, injectionPoint1));
+   }
+   
+   @Test
+   public void testAllOnBean(Consumer consumer) throws Throwable
+   {
+      consumer.check();
+      Consumer consumer1 = Utils.deserialize(Utils.serialize(consumer));
+      consumer1.check();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import java.security.Principal;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+public class Checker
+{
+   
+   public static boolean checkPrincipal(Principal principal)
+   {
+      principal.getName();
+      return true;
+   }
+   
+   public static boolean checkBeanManager(BeanManager beanManager)
+   {
+      return beanManager != null && beanManager.isScope(ApplicationScoped.class);
+   }
+   
+   public static boolean checkUserTransaction(UserTransaction userTransaction)
+   {
+      try
+      {
+         if (userTransaction != null)
+         {
+            userTransaction.getStatus();
+            return true;
+         }
+      }
+      catch (SystemException e)
+      {
+         throw new RuntimeException(e);
+      }
+      return false;
+   }
+   
+   public static boolean checkValidator(Validator validator)
+   {
+      try
+      {
+         if (validator != null)
+         {
+            validator.unwrap(String.class);
+         }
+      }
+      catch (ValidationException e)
+      {
+         return true;
+      }
+      return false;
+   }
+
+   public static boolean checkValidatorFactory(ValidatorFactory validatorFactory)
+   {
+      try
+      {
+         if (validatorFactory != null)
+         {
+            validatorFactory.unwrap(String.class);
+         }
+      }
+      catch (ValidationException e)
+      {
+         return true;
+      }
+      return false;
+   }
+   
+   public static boolean checkInstance(Instance<Cow> cow)
+   {
+      if (cow != null && cow.get() != null)
+      {
+         return "Daisy".equals(cow.get().getName());
+      }
+      else
+      {
+         return false;
+      }
+   }
+   
+   public static boolean checkEvent(Event<Cow> cowEvent, CowEventObserver observer)
+   {
+      observer.reset();
+      if (cowEvent != null)
+      {
+         cowEvent.fire(new Cow());
+         return observer.isObserved(); 
+      }
+      else
+      {
+         return false;
+      }
+   }
+
+   public static boolean checkInjectionPoint(InjectionPoint injectionPoint, Class<?> injectedClass)
+   {
+      if (injectionPoint != null)
+      {
+         return injectedClass.equals(injectionPoint.getBean().getBeanClass());
+      }
+      else
+      {
+         return false;
+      }
+   }
+   
+   public static boolean checkEquality(Object object1, Object object2)
+   {
+      return object1.equals(object2) && object1.hashCode() == object2.hashCode();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+ at SessionScoped
+public class ConstructorInjectionPointConsumer implements Serializable
+{
+   
+   public ConstructorInjectionPointConsumer() {}
+   
+   @Inject
+   public ConstructorInjectionPointConsumer(Dog dog) {}
+   
+   public void ping() {}
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.transaction.UserTransaction;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+ at SessionScoped
+public class Consumer implements Serializable
+{
+   
+   @Inject Validator validator;
+   @Inject ValidatorFactory validatorFactory;
+   // Not working incontainer as there is no principal
+   //@Inject Principal principal;
+   @Inject UserTransaction userTransaction;
+   @Inject BeanManager beanManager;
+   @Inject Instance<Cow> cow;
+   @Inject Event<Cow> event;
+   @Inject CowEventObserver observer;
+   
+   @PostConstruct
+   public void postConstruct()
+   {
+      cow.get().setName("Daisy");
+   }
+   
+   public Instance<Cow> getCow()
+   {
+      return cow;
+   }
+   
+   public Event<Cow> getEvent()
+   {
+      return event;
+   }
+   
+   public void check()
+   {
+      assert Checker.checkBeanManager(beanManager);
+
+      // Not working incontainer as there is no principal
+      //assert Checker.checkPrincipal(principal);
+      assert Checker.checkUserTransaction(userTransaction);
+      assert Checker.checkValidator(validator);
+      assert Checker.checkValidatorFactory(validatorFactory);
+      assert Checker.checkInstance(cow);
+      assert Checker.checkEvent(event, observer);
+   }
+   
+   
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+public class Cow
+{
+   
+   private String name;
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+ at ApplicationScoped
+public class CowEventObserver implements Serializable
+{
+   
+   private boolean observed;
+   
+   public void observeEvent(@Observes Cow cow)
+   {
+      this.observed = true;
+   }
+   
+   public boolean isObserved()
+   {
+      return observed;
+   }
+   
+   public void reset()
+   {
+      this.observed = false;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+public class Dog implements Serializable
+{
+   
+   private static InjectionPoint injectionPoint;
+   
+   @Inject
+   public Dog(InjectionPoint injectionPoint)
+   {
+      Dog.injectionPoint = injectionPoint;
+   }
+   
+   public static void reset()
+   {
+      Dog.injectionPoint = null;
+   }
+   
+   public static InjectionPoint getInjectionPoint()
+   {
+      return injectionPoint;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+ at SessionScoped
+public class FieldInjectionPointConsumer implements Serializable
+{
+   
+   @Inject Dog dogField;
+   
+   public void ping() {}
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+ at SessionScoped
+public class MethodInjectionPointConsumer implements Serializable
+{
+   
+   @Inject
+   public void setDog(Dog dog) {}
+   
+   public void ping() {}
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans;
+
+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.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RUNTIME)
+ at Target( { TYPE, METHOD, FIELD, PARAMETER })
+ at Documented
+ at interface Produced
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Checker.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Checker.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Checker.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.ee;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+public class Checker
+{
+   
+   public static boolean checkUserTransaction(UserTransaction userTransaction)
+   {
+      try
+      {
+         if (userTransaction != null)
+         {
+            userTransaction.getStatus();
+            return true;
+         }
+      }
+      catch (SystemException e)
+      {
+         throw new RuntimeException(e);
+      }
+      return false;
+   }
+   
+   
+   public static boolean checkEntityManager(EntityManager entityManager)
+   {
+      if (entityManager != null)
+      {
+         return entityManager.isOpen();
+      }
+      else
+      {
+         return false;
+      }
+   }
+   
+   public static boolean checkEntityManagerFactory(EntityManagerFactory entityManagerFactory)
+   {
+      if (entityManagerFactory != null)
+      {
+         return entityManagerFactory.isOpen();
+      }
+      else
+      {
+         return false;
+      }
+   }
+   
+   public static boolean checkRemoteEjb(HorseRemote horse)
+   {
+      if (horse != null)
+      {
+         return horse.ping();
+      }
+      else
+      {
+         return false;
+      }
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.ee;
+
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkEntityManager;
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkEntityManagerFactory;
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkRemoteEjb;
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkUserTransaction;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.transaction.UserTransaction;
+
+import org.junit.Assert;
+
+ at SessionScoped
+public class EEResourceConsumer implements Serializable
+{
+   
+   @Inject @Produced UserTransaction userTransaction;
+   @Inject @Produced EntityManager entityManager;
+   @Inject @Produced EntityManagerFactory entityManagerFactory;
+   @Inject @Produced HorseRemote horse;
+   
+   public void check()
+   {
+      Assert.assertTrue(checkUserTransaction(userTransaction));
+      Assert.assertTrue(checkEntityManager(entityManager));
+      Assert.assertTrue(checkEntityManagerFactory(entityManagerFactory));
+      Assert.assertTrue(checkRemoteEjb(horse));
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.ee;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+import javax.transaction.UserTransaction;
+
+public class EEResourceProducer
+{
+   
+   @Resource(mappedName="java:comp/UserTransaction")
+   @Produced
+   @Produces
+   private UserTransaction transaction;
+   
+   @PersistenceContext
+   @Produces
+   @Produced
+   private EntityManager entityManager;
+   
+   @PersistenceUnit
+   @Produces
+   @Produced
+   private EntityManagerFactory entityManagerFactory;
+   
+   @EJB
+   @Produces
+   @Produced
+   private HorseRemote horse;
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.ee;
+
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkEntityManager;
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkEntityManagerFactory;
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkRemoteEjb;
+import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkUserTransaction;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.transaction.UserTransaction;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class EEResourceProducerFieldPassivationCapableTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(EEResourceProducerFieldPassivationCapableTest.class.getPackage())
+                  .addClass(Utils.class)
+                  .addManifestResource(
+                        EEResourceProducerFieldPassivationCapableTest.class.getPackage(), 
+                        "persistence.xml", "persistence.xml")
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+
+   @Test
+   public void testResource(@Produced UserTransaction userTransaction) throws Throwable
+   {
+      UserTransaction userTransaction1 = Utils.deserialize(Utils.serialize(userTransaction));
+      Assert.assertTrue(checkUserTransaction(userTransaction1));
+   }
+   
+   @Test
+   public void testEntityManager(@Produced EntityManager entityManager) throws Throwable
+   {
+      EntityManager entityManager1 = Utils.deserialize(Utils.serialize(entityManager));
+      Assert.assertTrue(checkEntityManager(entityManager1));
+   }
+   
+   @Test
+   public void testEntityManagerFactory(@Produced EntityManagerFactory entityManagerFactory) throws Throwable
+   {
+      EntityManagerFactory entityManagerFactory1 = Utils.deserialize(Utils.serialize(entityManagerFactory));
+      Assert.assertTrue(checkEntityManagerFactory(entityManagerFactory1));
+   }
+   
+   @Test
+   public void testRemoteEjb(@Produced HorseRemote horse) throws Throwable
+   {
+      HorseRemote horse1 = Utils.deserialize(Utils.serialize(horse));
+      Assert.assertTrue(checkRemoteEjb(horse1));
+   }
+   
+   @Test
+   public void testAllOnBean(EEResourceConsumer consumer) throws Throwable
+   {
+      consumer.check();
+      EEResourceConsumer consumer1 = Utils.deserialize(Utils.serialize(consumer));
+      consumer1.check();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Horse.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Horse.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Horse.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.ee;
+
+import javax.ejb.Stateful;
+
+
+ at Stateful
+public class Horse implements HorseRemote
+{
+   public boolean ping()
+   {
+      return true;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/HorseRemote.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/HorseRemote.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/HorseRemote.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.ee;
+
+import javax.ejb.Remote;
+
+ at Remote
+public interface HorseRemote
+{
+
+   public boolean ping();
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Produced.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Produced.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/Produced.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.ee;
+
+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.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RUNTIME)
+ at Target( { TYPE, METHOD, FIELD, PARAMETER })
+ at Documented
+ at interface Produced
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.weld471;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+public class Bar {
+	@Inject @New private Instance<Foo> foo;
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.weld471;
+
+import javax.enterprise.context.ApplicationScoped;
+
+ at ApplicationScoped
+public class Foo {
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.builtinBeans.weld471;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class InstanceTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(InstanceTest.class.getPackage());
+   }
+
+	@Test
+	public void testNewInstance(Bar bar) 
+	{
+	   Assert.assertNotNull(bar);
+	}
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.contexts;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.context.ApplicationScoped;
+
+ at ApplicationScoped
+public class ApplicationScopedObject
+{
+   private AtomicInteger counter = new AtomicInteger();
+
+   public void increment()
+   {
+      counter.incrementAndGet();
+   }
+   public int getValue()
+   {
+      return counter.get();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.contexts;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ApplicationScopedTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ApplicationScopedTest.class.getPackage());
+   }
+
+   @Test
+   public void testConcurrentInitilized(final ApplicationScopedObject applicationScopedObject) throws InterruptedException
+   {
+      final CountDownLatch latch = new CountDownLatch(10);
+      for (int i = 0; i < 10; i++)
+      {
+         new Thread(new Runnable()
+         {
+            public void run()
+            {
+               try
+               {
+                  applicationScopedObject.increment();
+               }
+               finally
+               {
+                  latch.countDown();
+               }
+            }
+         }).start();
+      }
+      latch.await();
+      int value = applicationScopedObject.getValue();
+      assert value == 10;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.contexts;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ContextTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ContextTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   /*
+    * description = "WELD-348"
+    */
+   @Test
+   public void testCallToConversationWithContextNotActive()
+   {
+      boolean alreadyActive = false;
+      try
+      {
+         alreadyActive = Container.instance().services().get(ContextLifecycle.class).isConversationActive();
+         if (alreadyActive)
+         {
+            Container.instance().services().get(ContextLifecycle.class).getConversationContext().setActive(false);
+         }
+         try
+         {
+            Utils.getReference(beanManager, Conversation.class).getId();
+            Assert.fail();
+         }
+         catch (ContextNotActiveException e) 
+         {
+            // Expected
+         }
+         catch (Exception e) 
+         {
+            Assert.fail();
+         }
+         try
+         {
+            Utils.getReference(beanManager, Conversation.class).getTimeout();
+            Assert.fail();
+         }
+         catch (ContextNotActiveException e) 
+         {
+            // Expected
+         }
+         catch (Exception e) 
+         {
+            Assert.fail();
+         }
+         try
+         {
+            Utils.getReference(beanManager, Conversation.class).begin();
+            Assert.fail();
+         }
+         catch (ContextNotActiveException e) 
+         {
+            // Expected
+         }
+         catch (Exception e) 
+         {
+            Assert.fail();
+         }
+         try
+         {
+            Utils.getReference(beanManager, Conversation.class).begin("foo");
+            Assert.fail();
+         }
+         catch (ContextNotActiveException e) 
+         {
+            // Expected
+         }
+         catch (Exception e) 
+         {
+            Assert.fail();
+         }
+         try
+         {
+            Utils.getReference(beanManager, Conversation.class).end();
+            Assert.fail();
+         }
+         catch (ContextNotActiveException e) 
+         {
+            // Expected
+         }
+         catch (Exception e) 
+         {
+            Assert.fail();
+         }
+         try
+         {
+            Utils.getReference(beanManager, Conversation.class).isTransient();
+            Assert.fail();
+         }
+         catch (ContextNotActiveException e) 
+         {
+            // Expected
+         }
+         catch (Exception e) 
+         {
+            Assert.fail();
+         }
+         try
+         {
+            Utils.getReference(beanManager, Conversation.class).setTimeout(0);
+            assert false;
+         }
+         catch (ContextNotActiveException e) 
+         {
+            // Expected
+         }
+         catch (Exception e) 
+         {
+            Assert.fail();
+         }
+      }
+      finally
+      {
+         if (alreadyActive)
+         {
+            Container.instance().services().get(ContextLifecycle.class).getConversationContext().setActive(true);
+         }
+      }
+      
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.contexts;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+public class ParameterizedTypeScoped
+{
+
+   @RequestScoped
+   @Produces
+   public List<String> create()
+   {
+      return Arrays.asList("iemon", "houjitya");
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.contexts;
+
+import java.util.List;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ParameterizedTypeScopedTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ParameterizedTypeScopedTest.class.getPackage());
+   }
+
+   @Test
+   public void testStringList(StringHolder holder)
+   {
+      List<String> str = holder.getStrings();
+      Assert.assertEquals(2, str.size());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.contexts;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class PassivatingContextTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(PassivatingContextTest.class.getPackage());
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   /**
+    * The built-in session and conversation scopes are passivating. No other
+    * built-in scope is passivating.
+    */
+   @Test
+   public void testIsSessionScopePassivating()
+   {
+      Assert.assertTrue(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(SessionScoped.class).isPassivating());
+   }
+
+   /**
+    * The built-in session and conversation scopes are passivating. No other
+    * built-in scope is passivating.
+    */
+   @Test
+   public void testIsConversationScopePassivating()
+   {
+      Assert.assertTrue(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(ConversationScoped.class).isPassivating());
+   }
+
+   /**
+    * The built-in session and conversation scopes are passivating. No other
+    * built-in scope is passivating.
+    */
+   @Test
+   public void testIsApplicationScopeNonPassivating()
+   {
+      Assert.assertFalse(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(ApplicationScoped.class).isPassivating());
+   }
+
+   /**
+    * The built-in session and conversation scopes are passivating. No other
+    * built-in scope is passivating.
+    */
+   @Test
+   public void testIsRequestScopeNonPassivating()
+   {
+      Assert.assertFalse(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(RequestScoped.class).isPassivating());
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.contexts;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+
+public class StringHolder
+{
+
+   @Inject 
+   private List<String> strings;
+   
+   public List<String> getStrings()
+   {
+      return strings;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+public interface AbstractDAO<E>
+{
+   public boolean save(E entity);
+   
+   public boolean isSaved();
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+
+public abstract class AbstractDAOImpl<E>
+{
+   
+   private boolean saved;
+
+   public boolean save(E entity)
+   {
+      this.saved = true;
+      return true;
+   }
+   
+   public boolean isSaved()
+   {
+      return saved;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+public interface Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Remote;
+
+ at Remote
+public interface Bird
+{
+
+   public void observe(Feed feed);
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+public class BowlerHatException extends RuntimeException
+{
+
+   public BowlerHatException()
+   {
+      super();
+   }
+
+   public BowlerHatException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   public BowlerHatException(String message)
+   {
+      super(message);
+   }
+
+   public BowlerHatException(Throwable cause)
+   {
+      super(cause);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateful;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+
+ at Stateful
+ at RequestScoped
+public class Capercaillie implements Scottish, Bird
+{
+
+   private Feed feed;
+   
+   public void observe(@Observes Feed feed)
+   {
+      this.feed = feed;
+   }
+   
+   public Feed getFeed()
+   {
+      return feed;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class Castle
+{
+   
+   private boolean pinged;
+   
+   public boolean isPinged()
+   {
+      return pinged;
+   }
+   
+   public void ping()
+   {
+      this.pinged = true;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateful;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Stateful
+public class Cat implements CatLocal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+/**
+ * @author pmuir
+ *
+ */
+ at Local
+public interface CatLocal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface DAO
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+ at Local
+public interface Dog extends Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+
+ at Stateless
+public class DogBean implements Dog
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.ejb.InternalEjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author pmuir
+ *
+ */
+ at RunWith(Arquillian.class)
+public class EjbDescriptorLookupTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(EjbDescriptorLookupTest.class.getPackage())
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testCorrectSubType()
+   {
+      EjbDescriptor<CatLocal> descriptor = beanManager.getEjbDescriptor("Cat");
+      assert descriptor.getClass().equals(InternalEjbDescriptor.class);
+      Bean<CatLocal> bean = beanManager.getBean(descriptor);
+      Assert.assertNotNull(bean);
+      Assert.assertTrue(bean instanceof SessionBean<?>);
+      Assert.assertEquals(Cat.class, bean.getBeanClass());
+      InjectionTarget<CatLocal> it = beanManager.createInjectionTarget(descriptor);
+      Assert.assertNotNull(it);
+      Assert.assertEquals(bean.getInjectionPoints(), it.getInjectionPoints());
+      Assert.assertTrue(it.produce(beanManager.createCreationalContext(bean)) instanceof CatLocal);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class EnterpriseBeanDefinitionTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(BeanArchive.class)
+                  .addPackage(EnterpriseBeanDefinitionTest.class.getPackage())
+                  .addClass(Utils.class)
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   /*
+    * description="WELD-305"
+    */
+   @Test
+   public void testSuperInterfacesAreBeanTypes()
+   {
+      Bean<?> bean = Utils.getBean(beanManager, Dog.class);
+      Assert.assertTrue(Utils.typeSetMatches(bean.getTypes(), Object.class, Dog.class, Animal.class));
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,154 @@
+/*
+
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.EJBException;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class EnterpriseBeanTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(EnterpriseBeanTest.class.getPackage())
+                  .addClass(Utils.class)
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+                  .addManifestResource(EjbDescriptorLookupTest.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml")
+         );
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   /*
+    * description="WBRI-179"
+    */
+   @Test
+   public void testSFSBWithOnlyRemoteInterfacesDeploys()
+   {
+      // TODO: Need implementation ?
+   }
+   
+   /*
+    * description="WELD-326"
+    */
+   @Test
+   public void testInvocationExceptionIsUnwrapped(Fedora fedora)
+   {
+      try
+      {
+         fedora.causeRuntimeException();
+      }
+      catch (Throwable t)
+      {
+         if (t instanceof EJBException && t.getCause() instanceof BowlerHatException)
+         {
+            return;
+         }
+      }
+      Assert.fail("Expected a BowlerHatException to be thrown");
+   }   
+   
+   /*
+    * description="WBRI-275"
+    */
+   @Test
+   public void testSLSBBusinessMethodThrowsRuntimeException(Fedora fedora)
+   {
+      try
+      {
+         fedora.causeRuntimeException();
+      }
+      catch (Throwable t) 
+      {
+         if (Utils.isExceptionInHierarchy(t, BowlerHatException.class))
+         {
+            return;
+         }
+      }
+      Assert.fail("Expected a BowlerHatException to be in the cause stack");
+   }
+   
+   /*
+    * description = "WELD-364"
+    */
+   @Test
+   @Category(Broken.class)
+   public void testEJBRemoteInterfacesOkForObservers(Scottish scottish)
+   {
+      Feed feed = new Feed();
+      beanManager.fireEvent(feed);
+      Assert.assertEquals(feed, scottish.getFeed());
+   }
+   
+   /*
+    * description = "WELD-381"
+    */
+   @Test
+   public void testGenericEJBWorks(ResultClient client)
+   {
+      Assert.assertEquals("pete", client.lookupPete().getUsername());
+   }
+   
+   /*
+    * description = "WELD-80"
+    */
+   @Test
+   @Category(Broken.class)
+   public void testPassivationOfEjbs(HelloAction action)
+   {
+      action.executeRequest();
+      Assert.assertEquals("hello", action.getHello());
+      Assert.assertEquals("goodbye", action.getGoodBye());
+   }
+   
+   /*
+    * description = "Simple test for no-interface views"
+    */
+   @Test
+   @Category(Broken.class)
+   public void testNoInterfaceView(Castle castle)
+   {
+      castle.ping();
+      Assert.assertTrue(castle.isPinged());
+      Assert.assertTrue(Utils.getBean(beanManager, Castle.class) instanceof SessionBean<?>);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+ at Local
+public interface Fedora
+{
+   
+   public void causeRuntimeException();
+   
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class FedoraImpl implements Fedora
+{
+
+   public void causeRuntimeException()
+   {
+      throw new BowlerHatException();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+public class Feed
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateful;
+
+ at Stateful
+public class Hat implements HatRemote
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Remote;
+
+ at Remote
+public interface HatRemote
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.inject.Inject;
+
+public class HelloAction
+{
+   
+   public static long sleepDuration = 1000 * 2;
+   
+   @Inject
+   private IHelloBean helloBean;
+
+   private String hello;
+   private String goodBye;
+
+   public void executeRequest()
+   {
+      hello = helloBean.sayHello();
+      try
+      {
+         Thread.sleep(sleepDuration);
+      }
+      catch (InterruptedException e)
+      {
+         System.out.println("Caught Interruption.");
+      }
+      goodBye = helloBean.sayGoodbye();
+   }
+
+   public String getHello()
+   {
+      return hello;
+   }
+
+   public String getGoodBye()
+   {
+      return goodBye;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.annotation.Resource;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+
+ at Stateful
+ at SessionScoped
+ at CacheConfig(idleTimeoutSeconds=1)
+public class HelloBean implements IHelloBean
+{
+   @Resource(mappedName = "java:comp/BeanManager")
+   private BeanManager beanManager;
+
+   public String sayHello()
+   {
+      return "hello";
+   }
+
+   public String sayGoodbye()
+   {
+      return beanManager.getELResolver() != null ? "goodbye" : "error";
+   }
+
+   @Remove
+   public void remove()
+   {
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+ at Local
+public interface IHelloBean
+{
+
+   public abstract String sayHello();
+
+   public abstract String sayGoodbye();
+
+   public abstract void remove();
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+public class Result
+{
+   
+   private final String username;
+   
+   public Result(String username)
+   {
+      this.username = username;
+   }
+
+   public String getUsername()
+   {
+      return username;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.inject.Inject;
+
+public class ResultClient
+{
+   
+   @Inject @DAO ResultDAO result;
+   
+   public Result lookupPete()
+   {
+      return result.findByUser("pete");
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+ at Local
+public interface ResultDAO extends AbstractDAO<Result>
+{
+
+   public Result findByUser(String username);
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+ at DAO
+ at Stateless
+public class ResultDAOImpl extends AbstractDAOImpl<Result> implements ResultDAO
+{
+   public Result findByUser(String username)
+   {
+      return new Result(username);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+ at Local
+public interface Scottish
+{
+
+   public Feed getFeed();
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/AlteStadt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/AlteStadt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/AlteStadt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface AlteStadt
+{
+   public String getPlaceOfInterest();
+   
+   public void performPostConstructChecks();
+   
+   public void initializeBean(GutenbergMuseum pointOfInterest);
+   
+   public GutenbergMuseum getAnotherPlaceOfInterest();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanImpl.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class BeanImpl implements BeanLocal
+{
+   
+   public void ping()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/BeanLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+public interface BeanLocal
+{
+   
+   public void ping();
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessor.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Stateful;
+
+ at Stateful
+public class DirectOrderProcessor extends OrderProcessor implements DirectOrderProcessorLocal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessorLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessorLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/DirectOrderProcessorLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface DirectOrderProcessorLocal
+{
+   void order();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.RequestContext;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * Sections
+ * 
+ * 6.5. Lifecycle of stateful session beans 
+ * 6.6. Lifecycle of stateless session and singleton beans 
+ * 6.11. Lifecycle of EJBs
+ * 
+ * Mostly overlapping with other tests...
+ * 
+ * @author Nicklas Karlsson
+ * @author David Allen
+ * 
+ * Spec version: Public Release Draft 2
+ * 
+ */
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class EnterpriseBeanLifecycleTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class, "test.jar")
+                  .addPackage(EnterpriseBeanLifecycleTest.class.getPackage())
+                  .addClass(Utils.class)
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+
+   @Inject 
+   private BeanManagerImpl beanManager;
+   
+   /**
+    * When the create() method of a Bean object that represents a stateful
+    * session bean that is called, the container creates and returns a session
+    * bean proxy, as defined in Section 3.3.9, "Session bean proxies".
+    */
+   @Test
+   public void testCreateSFSB(GrossStadt frankfurt)
+   {
+      Bean<KleinStadt> stadtBean = Utils.getBean(beanManager, KleinStadt.class);
+      Assert.assertNotNull("Expected a bean for stateful session bean Kassel", stadtBean);
+      CreationalContext<KleinStadt> creationalContext = new MockCreationalContext<KleinStadt>();
+      KleinStadt stadtInstance = stadtBean.create(creationalContext);
+      Assert.assertNotNull("Expected instance to be created by container", stadtInstance);
+      Assert.assertTrue("PostConstruct should be invoked when bean instance is created", frankfurt.isKleinStadtCreated());
+      frankfurt.resetCreatedFlags();
+      
+      // Create a second one to make sure create always does create a new session bean
+      KleinStadt anotherStadtInstance = stadtBean.create(creationalContext);
+      Assert.assertNotNull("Expected second instance of session bean", anotherStadtInstance);
+      Assert.assertTrue(frankfurt.isKleinStadtCreated());
+      Assert.assertNotSame("create() should not return same bean as before", anotherStadtInstance, stadtInstance);
+      
+      // Verify that the instance returned is a proxy by checking for all local interfaces
+      Assert.assertTrue(stadtInstance instanceof KleinStadt);
+      Assert.assertTrue(stadtInstance instanceof SchoeneStadt);
+   }
+
+   @Test
+   public void testDestroyRemovesSFSB(GrossStadt frankfurt) throws Exception
+   {
+      Bean<KleinStadt> stadtBean = Utils.getBean(beanManager, KleinStadt.class);
+      Assert.assertNotNull("Expected a bean for stateful session bean Kassel", stadtBean);
+      RequestContext requestContext = Container.instance().services().get(ContextLifecycle.class).getRequestContext();
+      CreationalContext<KleinStadt> creationalContext = new MockCreationalContext<KleinStadt>();
+      KleinStadt kassel = requestContext.get(stadtBean, creationalContext);
+      stadtBean.destroy(kassel, creationalContext);
+      
+      Assert.assertTrue("Expected SFSB bean to be destroyed", frankfurt.isKleinStadtDestroyed());
+      requestContext.destroy();
+      kassel = requestContext.get(stadtBean);
+      Assert.assertNull("SFSB bean should not exist after being destroyed", kassel);
+   }
+   
+   @Test
+   public void testDestroyDoesntTryToRemoveSLSB()
+   {
+      Bean<BeanLocal> bean = Utils.getBean(beanManager, BeanLocal.class);
+      Assert.assertNotNull("Expected a bean for stateless session bean BeanLocal", bean);
+      CreationalContext<BeanLocal> creationalContext = beanManager.createCreationalContext(bean);
+      BeanLocal instance = bean.create(creationalContext);
+      bean.destroy(instance, creationalContext);
+   }
+ 
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/FrankfurtAmMain.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/FrankfurtAmMain.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/FrankfurtAmMain.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.enterprise.context.RequestScoped;
+
+ at Stateful
+ at RequestScoped
+public class FrankfurtAmMain implements GrossStadt
+{
+
+   private boolean kleinStadtCreated = false;
+   private boolean kleinStadtDestroyed = false;
+   
+   public boolean isKleinStadtCreated()
+   {
+      return kleinStadtCreated;
+   }
+
+   public boolean isKleinStadtDestroyed()
+   {
+      return kleinStadtDestroyed;
+   }
+
+   public void kleinStadtCreated()
+   {
+      kleinStadtCreated = true;
+   }
+
+   public void kleinStadtDestroyed()
+   {
+      kleinStadtDestroyed = true;
+   }
+
+   public void resetCreatedFlags()
+   {
+      kleinStadtCreated = false;
+   }
+
+   public void resetDestroyedFlags()
+   {
+      kleinStadtDestroyed = false;
+   }
+
+   @Remove
+   public void dispose()
+   {
+   }
+
+   private boolean schlossDestroyed = false;
+
+   public boolean isSchlossDestroyed()
+   {
+      return schlossDestroyed;
+   }
+
+   public void schlossDestroyed()
+   {
+      schlossDestroyed = true;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GeschichtslosStadt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GeschichtslosStadt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GeschichtslosStadt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface GeschichtslosStadt
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Giessen.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Giessen.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Giessen.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+public class Giessen implements NeueStadt, GeschichtslosStadt
+{
+
+   public void mehrBauen()
+   {
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GrossStadt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GrossStadt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GrossStadt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface GrossStadt
+{
+   public void kleinStadtCreated();
+   
+   public void kleinStadtDestroyed();
+   
+   public boolean isKleinStadtCreated();
+   
+   public boolean isKleinStadtDestroyed();
+   
+   public void resetCreatedFlags();
+   
+   public void resetDestroyedFlags();
+   
+   public void dispose();
+
+   public void schlossDestroyed();
+
+   public boolean isSchlossDestroyed();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GutenbergMuseum.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GutenbergMuseum.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/GutenbergMuseum.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+public class GutenbergMuseum
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IndirectOrderProcessor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IndirectOrderProcessor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IndirectOrderProcessor.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Stateful;
+
+ at Stateful
+public class IndirectOrderProcessor extends IntermediateOrderProcessor implements OrderProcessorLocal
+{
+ 
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IntermediateOrderProcessor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IntermediateOrderProcessor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/IntermediateOrderProcessor.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+class IntermediateOrderProcessor extends OrderProcessor
+{
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Kassel.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Kassel.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Kassel.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+ at Stateful
+ at RequestScoped
+public class Kassel implements KleinStadt, SchoeneStadt
+{
+   @Inject
+   private GrossStadt grossStadt;
+   
+   @PostConstruct
+   public void begruendet()
+   {
+      grossStadt.kleinStadtCreated();
+   }
+
+   @Remove
+   public void zustandVergessen()
+   {
+   }
+
+   @PreDestroy
+   public void zustandVerloren()
+   {
+      grossStadt.kleinStadtDestroyed();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/KleinStadt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/KleinStadt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/KleinStadt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface KleinStadt
+{
+   public void begruendet();
+   
+   public void zustandVergessen();
+   
+   public void zustandVerloren();
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/LandgraffenSchloss.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/LandgraffenSchloss.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/LandgraffenSchloss.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+
+ at Stateful
+ at Dependent
+public class LandgraffenSchloss implements Schloss
+{
+   @Inject
+   private GrossStadt biggerCity;
+
+   @PreDestroy
+   public void destructionCallback()
+   {
+      biggerCity.schlossDestroyed();
+   }
+
+   @Remove
+   public void remove()
+   {
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Mainz.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Mainz.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Mainz.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Stateless;
+import javax.inject.Inject;
+
+ at Stateless
+public class Mainz implements AlteStadt
+{
+   @Inject
+   private RoemerPassage placeOfInterest;
+   
+   private GutenbergMuseum anotherPlaceOfInterest;
+   
+   private String name;
+
+   public String getPlaceOfInterest()
+   {
+      return name;
+   }
+
+   @PostConstruct
+   public void performPostConstructChecks()
+   {
+      if ( placeOfInterest != null )
+         name = placeOfInterest.getName();
+   }
+   
+   @Inject
+   public void initializeBean(GutenbergMuseum pointOfInterest)
+   {
+      this.anotherPlaceOfInterest = pointOfInterest;
+   }
+
+   public GutenbergMuseum getAnotherPlaceOfInterest()
+   {
+      return anotherPlaceOfInterest;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Marburg.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Marburg.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Marburg.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Inject;
+
+ at Stateful
+public class Marburg implements UniStadt
+{
+   @Inject
+   private Schloss theCastle;
+
+   @Remove
+   public void removeBean()
+   {
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/MockCreationalContext.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/MockCreationalContext.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/MockCreationalContext.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+public class MockCreationalContext<T> implements CreationalContext<T>
+{
+
+   public void push(T incompleteInstance)
+   {
+
+   }
+   
+   public void release()
+   {
+      // TODO Auto-generated method stub
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/NeueStadt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/NeueStadt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/NeueStadt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface NeueStadt
+{
+   public void mehrBauen();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessor.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class OrderProcessor
+{   
+   public static boolean postConstructCalled = false;
+   
+   public static boolean preDestroyCalled = true;
+   
+   @PostConstruct
+   public void postConstruct()
+   {
+      postConstructCalled = true;
+   }
+   
+   @PreDestroy
+   public void preDestroy()
+   {
+      preDestroyCalled = true;
+   }
+   
+   public void order()
+   {
+      
+   }
+    
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessorLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessorLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/OrderProcessorLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface OrderProcessorLocal
+{
+   void order();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/RoemerPassage.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/RoemerPassage.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/RoemerPassage.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+class RoemerPassage
+{
+   public final static String name = "RoemerPassage";
+   
+   public String getName()
+   {
+      return name;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Schloss.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Schloss.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/Schloss.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface Schloss
+{
+   public void destructionCallback();
+   
+   public void remove();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/SchoeneStadt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/SchoeneStadt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/SchoeneStadt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface SchoeneStadt
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/UniStadt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/UniStadt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/UniStadt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.lifecycle;
+
+import javax.ejb.Local;
+
+ at Local
+public interface UniStadt
+{
+   public void removeBean();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.proxyability;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class EnterpriseBeanLifecycleTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(EnterpriseBeanLifecycleTest.class.getPackage())
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+
+   /*
+    * description="WELD-290"
+    */
+   @Test
+   public void testSLSBInjectedIntoPassivatingManagedBean(SimpleBean bean)
+   {
+      Assert.assertEquals("This is my message from my stateless bean", bean.getMessage());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.proxyability;
+
+import java.io.Serializable;
+
+import javax.ejb.Stateless;
+
+/**
+ * Session Bean implementation class MyStatelessBean
+ */
+ at Stateless
+public class MyStatelessBean implements MyStatelessBeanLocal, Serializable
+{
+
+   public String getText()
+   {
+      return "This is my message from my stateless bean";
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBeanLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBeanLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/MyStatelessBeanLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.proxyability;
+
+import javax.ejb.Local;
+
+ at Local
+public interface MyStatelessBeanLocal
+{
+
+   String getText();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/SimpleBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/SimpleBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/SimpleBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.enterprise.proxyability;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+ at SessionScoped
+public class SimpleBean implements Serializable
+{
+
+   @Inject
+   private MyStatelessBeanLocal myStatelessBean;
+
+   public String getMessage()
+   {
+      return myStatelessBean.getText();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.event;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+ at RequestScoped
+public class Bar
+{
+
+   @Inject Event<String> event;
+   
+   @Inject @Updated Event<String> updatedEvent;
+   
+   @Inject BeanManager manager;
+   
+   private boolean unqualifiedObserved;
+   private boolean updatedObserved;
+
+   public void fireWithNoQualifiers()
+   {
+      event.fire("");
+   }
+   
+   public void fireWithUpdatedQualifierViaSelect()
+   {
+      event.select(new AnnotationLiteral<Updated>() {}).fire("");
+   }
+   
+   public void fireWithNoQualifiersViaManager()
+   {
+      manager.fireEvent("");
+   }
+   
+   public void fireWithUpdatedQualifierViaManager()
+   {
+      manager.fireEvent("", new AnnotationLiteral<Updated>() {});
+   }
+   
+   public void fireWithUpdatedQualifierViaAnnotation()
+   {
+      updatedEvent.fire("");
+   }
+   
+   public void reset()
+   {
+      unqualifiedObserved = false;
+      updatedObserved = false;
+   }
+
+   public void onEvent(@Observes String event)
+   {
+      unqualifiedObserved = true;
+   }
+
+   private void onUpdatedEvent(@Observes @Updated String event)
+   {
+      updatedObserved = true;
+   }
+   
+   public boolean isUnqualifiedObserved()
+   {
+      return unqualifiedObserved;
+   }
+   
+   public boolean isUpdatedObserved()
+   {
+      return updatedObserved;
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.event;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class EventQualifierTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(EventQualifierTest.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-226"
+    */
+   @Test
+   public void testDefaultQualifierNotRequired(Bar bar)
+   {
+      bar.fireWithNoQualifiers();
+      Assert.assertTrue(bar.isUnqualifiedObserved());
+      Assert.assertFalse(bar.isUpdatedObserved());
+      bar.reset();
+      bar.fireWithNoQualifiersViaManager();
+      Assert.assertTrue(bar.isUnqualifiedObserved());
+      Assert.assertFalse(bar.isUpdatedObserved());
+      bar.reset();
+      bar.fireWithUpdatedQualifierViaAnnotation();
+      Assert.assertTrue(bar.isUnqualifiedObserved());
+      Assert.assertTrue(bar.isUpdatedObserved());
+      bar.reset();
+      bar.fireWithUpdatedQualifierViaManager();
+      Assert.assertTrue(bar.isUpdatedObserved());
+      Assert.assertTrue(bar.isUnqualifiedObserved());
+      bar.reset();
+      bar.fireWithUpdatedQualifierViaSelect();
+      Assert.assertTrue(bar.isUnqualifiedObserved());
+      Assert.assertTrue(bar.isUpdatedObserved());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.event;
+
+public class Foo
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.event;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+
+ at SessionScoped
+public class NormalScopedBean implements Serializable
+{
+
+   @Any Event<Foo> event;
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.event;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class) 
+public class SimpleEventTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(SimpleEventTest.class.getPackage());
+   }
+   
+   private static boolean RECEIVE_1_OBSERVED;
+   private static boolean RECEIVE_2_OBSERVED;
+   private static boolean RECEIVE_3_OBSERVED;
+   
+   private static void initFlags() {
+      RECEIVE_1_OBSERVED = false;
+      RECEIVE_2_OBSERVED = false;
+      RECEIVE_3_OBSERVED = false;
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testFireEventOnManager()
+   {
+      initFlags();
+
+      beanManager.fireEvent("Fired using Manager Interface with AnnotationLiteral.", new AnnotationLiteral<Updated>(){});
+
+      assert RECEIVE_1_OBSERVED == true;
+      assert RECEIVE_2_OBSERVED == true;
+      assert RECEIVE_3_OBSERVED == true;
+      
+      initFlags();
+      
+      beanManager.fireEvent("Fired using Manager Interface.");
+      
+      assert RECEIVE_1_OBSERVED == false; // not called
+      assert RECEIVE_2_OBSERVED == true;
+      assert RECEIVE_3_OBSERVED == true;
+   }
+   
+   @Test
+   public void testFireEventOnEvent(App app)
+   {
+      initFlags();
+      
+      app.fireEventByBindingDeclaredAtInjectionPoint();
+
+      assert RECEIVE_1_OBSERVED == true;
+      assert RECEIVE_2_OBSERVED == true;
+      assert RECEIVE_3_OBSERVED == true;
+      
+      initFlags();
+      
+      app.fireEventByAnnotationLiteral();
+      
+      assert RECEIVE_1_OBSERVED == true;
+      assert RECEIVE_2_OBSERVED == true;
+      assert RECEIVE_3_OBSERVED == true;
+      
+      initFlags();
+      
+      app.fireEventViaAny();
+      
+      assert RECEIVE_2_OBSERVED == true;
+      assert RECEIVE_1_OBSERVED == false; // not called
+      assert RECEIVE_3_OBSERVED == true;
+      
+      initFlags();
+      
+      app.fireEventViaWithNoQualifier();
+      
+      assert RECEIVE_1_OBSERVED == false; // not called
+      assert RECEIVE_2_OBSERVED == true;
+      assert RECEIVE_3_OBSERVED == true;
+   }
+
+   public static class App
+   {
+      @Inject @Any
+      Event<String> event1;
+      
+      @Inject @Updated
+      Event<String> event2;
+      
+      @Inject
+      Event<String> event4;
+
+      public void fireEventByAnnotationLiteral()
+      {
+         event1.select(new AnnotationLiteral<Updated>(){}).fire("Fired using Event Interface with AnnotationLiteral.");
+      }
+      
+      public void fireEventByBindingDeclaredAtInjectionPoint()
+      {
+         event2.fire("Fired using Event Interface with Binding Declared.");
+      }
+      
+      public void fireEventViaAny()
+      {
+         event1.fire("Fired using Event Interface");
+      }
+      
+      public void fireEventViaWithNoQualifier()
+      {
+         event4.fire("Fired using Event Interface with no qualifier");
+      }
+   }
+
+   public static class Receiver
+   {
+      public void receive1(@Observes @Updated String s)
+      {
+         RECEIVE_1_OBSERVED = true;
+      }
+
+      public void receive2(@Any @Observes String s)
+      {
+         RECEIVE_2_OBSERVED = true;
+      }
+      
+      public void receive3(@Observes String s)
+      {
+         RECEIVE_3_OBSERVED = true;
+      }
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.event;
+
+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.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RUNTIME)
+ at Target( { TYPE, METHOD, FIELD, PARAMETER })
+ at Documented
+ at interface Updated
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.exceptions;
+
+import javax.enterprise.inject.CreationException;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ExceptionHandlingTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ExceptionHandlingTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject 
+   private BeanManagerImpl beanManager;
+   
+   @Test(expected = FooException.class)
+   public void testCreationExceptionWrapsRealExceptionForSimpleBean() throws Exception
+   {
+      try
+      {
+         Utils.getReference(beanManager, Lorry_Broken.class);
+      }
+      catch (Exception e) 
+      {
+         if (e instanceof CreationException)
+         {
+            throw (Exception) e.getCause();
+         }
+      }
+   }
+   
+
+   @Test(expected = FooException.class)
+   public void testCreationExceptionWrapsRealExceptionForProducerBean() throws Exception
+   {
+      try
+      {
+         Utils.getReference(beanManager, Ship.class, new AnnotationLiteral<Large>() {});
+      }
+      catch (Exception e) 
+      {
+         if (e instanceof CreationException)
+         {
+            throw (Exception) e.getCause();
+         }
+      }
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/FooException.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/FooException.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/FooException.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.exceptions;
+
+public class FooException extends Exception
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Large.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Large.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Large.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.exceptions;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Large
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Lorry_Broken.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Lorry_Broken.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Lorry_Broken.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.exceptions;
+
+class Lorry_Broken
+{
+   
+   public Lorry_Broken() throws Exception
+   {
+      throw new FooException();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Ship.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Ship.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/Ship.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.exceptions;
+
+class Ship
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ShipProducer_Broken.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ShipProducer_Broken.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ShipProducer_Broken.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.exceptions;
+
+import javax.enterprise.inject.Produces;
+
+public class ShipProducer_Broken
+{
+   
+   @Produces @Large
+   public Ship produceShip() throws FooException
+   {
+      throw new FooException();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+public class Capercaillie
+{
+
+   public Capercaillie(String name)
+   {
+      // TODO Auto-generated constructor stub
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class Cow implements CowLocal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.ejb.Local;
+
+ at Local
+public interface CowLocal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,295 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+
+public class ExtensionObserver implements Extension
+{
+   
+   private boolean allBeforeBeanDiscovery;
+   private boolean allAfterBeanDiscovery;
+   private boolean allAfterDeploymentValidation;
+   private boolean allProcessBean;
+   private boolean allProcessInjectionTarget;
+   private boolean allProcessManagedBean;
+   private boolean allProcessObserverMethod;
+   private boolean allProcessProducer;
+   private boolean allProcessProducerField;
+   private boolean allProcessProducerMethod;
+   private boolean allProcessSessionBean;
+   private boolean allProcessAnnnotatedType;
+   
+   private boolean beforeBeanDiscovery;
+   private boolean afterBeanDiscovery;
+   private boolean afterDeploymentValidation;
+   private boolean processBean;
+   private boolean processInjectionTarget;
+   private boolean processManagedBean;
+   private boolean processObserverMethod;
+   private boolean processProducer;
+   private boolean processProducerField;
+   private boolean processProducerMethod;
+   private boolean processSessionBean;
+   private boolean processAnnotatedType;
+
+   public void observeAll(@Observes Object event)
+   {
+      if (event instanceof BeforeBeanDiscovery)
+      {
+         allBeforeBeanDiscovery = true;
+      }
+      if (event instanceof AfterBeanDiscovery)
+      {
+         allAfterBeanDiscovery = true;
+      }
+      if (event instanceof AfterDeploymentValidation)
+      {
+         allAfterDeploymentValidation = true;
+      }
+      if (event instanceof ProcessBean<?> && !(event instanceof ProcessProducerField<?, ?> || event instanceof ProcessProducerMethod<?, ?> || event instanceof ProcessManagedBean<?> || event instanceof ProcessSessionBean<?>))
+      {
+         allProcessBean = true;
+      }
+      if (event instanceof ProcessInjectionTarget<?>)
+      {
+         allProcessInjectionTarget = true;
+      }
+      if (event instanceof ProcessManagedBean<?>)
+      {
+         allProcessManagedBean = true;
+      }
+      if (event instanceof ProcessObserverMethod<?, ?>)
+      {
+         allProcessObserverMethod = true;
+      }
+      if (event instanceof ProcessProducer<?, ?>)
+      {
+         allProcessProducer = true;
+      }
+      if (event instanceof ProcessProducerField<?, ?>)
+      {
+         allProcessProducerField = true;
+      }
+      if (event instanceof ProcessProducerMethod<?, ?>)
+      {
+         allProcessProducerMethod = true;
+      }
+      if (event instanceof ProcessSessionBean<?>)
+      {
+         allProcessSessionBean = true;
+      }
+      if (event instanceof ProcessAnnotatedType<?>)
+      {
+         allProcessAnnnotatedType = true;
+      }
+   }
+   
+   public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
+   {
+      beforeBeanDiscovery = true;
+   }
+   
+   public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
+   {
+      afterBeanDiscovery = true;
+   }
+   
+   public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
+   {
+      afterDeploymentValidation = true;
+   }
+   
+   public void observeProcessBean(@Observes ProcessBean<?> event)
+   {
+      processBean = true;
+   }
+   
+   public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<?> event)
+   {
+      processInjectionTarget = true;
+   }
+   
+   public void observeProcessProducer(@Observes ProcessProducer<?, ?> event)
+   {
+      processProducer = true;
+   }
+   
+   public void observeProcessProducerMethod(@Observes ProcessProducerMethod<?, ?> event)
+   {
+      processProducerMethod = true;
+   }
+   
+   public void observeProcessProducerField(@Observes ProcessProducerField<?, ?> event)
+   {
+      processProducerField = true;
+   }
+   
+   public void observeProcessObserverMethod(@Observes ProcessObserverMethod<?, ?> event)
+   {
+      processObserverMethod = true;
+   }
+   
+   public void observeProcessManagedBean(@Observes ProcessManagedBean<?> event)
+   {
+      processManagedBean = true;
+   }
+   
+   public void observeProcessSessionBean(@Observes ProcessSessionBean<?> event)
+   {
+      processSessionBean = true;
+   }
+   
+   public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType<?> event)
+   {
+      processAnnotatedType = true;
+   }
+
+   public boolean isAllBeforeBeanDiscovery()
+   {
+      return allBeforeBeanDiscovery;
+   }
+
+   public boolean isAllAfterBeanDiscovery()
+   {
+      return allAfterBeanDiscovery;
+   }
+
+   public boolean isAllAfterDeploymentValidation()
+   {
+      return allAfterDeploymentValidation;
+   }
+
+   public boolean isAllProcessBean()
+   {
+      return allProcessBean;
+   }
+
+   public boolean isAllProcessInjectionTarget()
+   {
+      return allProcessInjectionTarget;
+   }
+
+   public boolean isAllProcessManagedBean()
+   {
+      return allProcessManagedBean;
+   }
+
+   public boolean isAllProcessObserverMethod()
+   {
+      return allProcessObserverMethod;
+   }
+
+   public boolean isAllProcessProducer()
+   {
+      return allProcessProducer;
+   }
+
+   public boolean isAllProcessProducerField()
+   {
+      return allProcessProducerField;
+   }
+
+   public boolean isAllProcessProducerMethod()
+   {
+      return allProcessProducerMethod;
+   }
+
+   public boolean isAllProcessSessionBean()
+   {
+      return allProcessSessionBean;
+   }
+
+   public boolean isAllProcessAnnnotatedType()
+   {
+      return allProcessAnnnotatedType;
+   }
+
+   public boolean isBeforeBeanDiscovery()
+   {
+      return beforeBeanDiscovery;
+   }
+
+   public boolean isAfterBeanDiscovery()
+   {
+      return afterBeanDiscovery;
+   }
+
+   public boolean isAfterDeploymentValidation()
+   {
+      return afterDeploymentValidation;
+   }
+
+   public boolean isProcessBean()
+   {
+      return processBean;
+   }
+
+   public boolean isProcessInjectionTarget()
+   {
+      return processInjectionTarget;
+   }
+
+   public boolean isProcessManagedBean()
+   {
+      return processManagedBean;
+   }
+
+   public boolean isProcessObserverMethod()
+   {
+      return processObserverMethod;
+   }
+
+   public boolean isProcessProducer()
+   {
+      return processProducer;
+   }
+
+   public boolean isProcessProducerField()
+   {
+      return processProducerField;
+   }
+
+   public boolean isProcessProducerMethod()
+   {
+      return processProducerMethod;
+   }
+
+   public boolean isProcessSessionBean()
+   {
+      return processSessionBean;
+   }
+
+   public boolean isProcessAnnotatedType()
+   {
+      return processAnnotatedType;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class ExtensionTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(BeanArchive.class)
+                  .addPackage(ExtensionTest.class.getPackage())
+                  .addServiceProvider(Extension.class, 
+                        SimpleExtension.class, 
+                        ExtensionObserver.class,
+                        WoodlandExtension.class)
+         );
+   }
+
+   /*
+    * description = "WELD-234"
+    */
+   @Test
+   public void testExtensionInjectableAsBean(SimpleExtension extension)
+   {
+      Assert.assertTrue(extension.isObservedBeforeBeanDiscovery());
+   }
+   
+   /*
+    * description = "WELD-243"
+    */
+   @Test
+   public void testContainerEventsOnlySentToExtensionBeans(ExtensionObserver extensionObserver, OtherObserver otherObserver)
+   {
+      Assert.assertTrue(extensionObserver.isBeforeBeanDiscovery());
+      Assert.assertTrue(extensionObserver.isAllBeforeBeanDiscovery());
+      Assert.assertFalse(otherObserver.isBeforeBeanDiscovery());
+      Assert.assertFalse(otherObserver.isAllBeforeBeanDiscovery());
+      
+      Assert.assertTrue(extensionObserver.isAfterBeanDiscovery());
+      Assert.assertTrue(extensionObserver.isAllAfterBeanDiscovery());
+      Assert.assertFalse(otherObserver.isAfterBeanDiscovery());
+      Assert.assertFalse(otherObserver.isAllAfterBeanDiscovery());
+      
+      Assert.assertTrue(extensionObserver.isProcessAnnotatedType());
+      Assert.assertTrue(extensionObserver.isAllProcessAnnnotatedType());
+      Assert.assertFalse(otherObserver.isProcessAnnotatedType());
+      Assert.assertFalse(otherObserver.isAllProcessAnnotatedType());
+      
+      Assert.assertTrue(extensionObserver.isProcessBean());
+      Assert.assertTrue(extensionObserver.isAllProcessBean());
+      Assert.assertFalse(otherObserver.isProcessBean());
+      Assert.assertFalse(otherObserver.isAllProcessBean());
+      
+      Assert.assertTrue(extensionObserver.isProcessInjectionTarget());
+      Assert.assertTrue(extensionObserver.isAllProcessInjectionTarget());
+      Assert.assertFalse(otherObserver.isProcessInjectionTarget());
+      Assert.assertFalse(otherObserver.isAllProcessInjectionTarget());
+      
+      Assert.assertTrue(extensionObserver.isProcessManagedBean());
+      Assert.assertTrue(extensionObserver.isAllProcessManagedBean());
+      Assert.assertFalse(otherObserver.isProcessManagedBean());
+      Assert.assertFalse(otherObserver.isAllProcessManagedBean());
+      
+      Assert.assertTrue(extensionObserver.isProcessObserverMethod());
+      Assert.assertTrue(extensionObserver.isAllProcessObserverMethod());
+      Assert.assertFalse(otherObserver.isProcessObserverMethod());
+      Assert.assertFalse(otherObserver.isAllProcessObserverMethod());
+      
+      Assert.assertTrue(extensionObserver.isProcessProducer());
+      Assert.assertTrue(extensionObserver.isAllProcessProducer());
+      Assert.assertFalse(otherObserver.isProcessProducer());
+      Assert.assertFalse(otherObserver.isAllProcessProducer());
+      
+      Assert.assertTrue(extensionObserver.isProcessProducerField());
+      Assert.assertTrue(extensionObserver.isAllProcessProducerField());
+      Assert.assertFalse(otherObserver.isProcessProducerField());
+      Assert.assertFalse(otherObserver.isAllProcessProducerField());
+      
+      Assert.assertTrue(extensionObserver.isProcessProducerMethod());
+      Assert.assertTrue(extensionObserver.isAllProcessProducerField());
+      Assert.assertFalse(otherObserver.isProcessProducerMethod());
+      Assert.assertFalse(otherObserver.isAllProcessProducerMethod());
+      
+      Assert.assertTrue(extensionObserver.isProcessSessionBean());
+      Assert.assertTrue(extensionObserver.isAllProcessSessionBean());
+      Assert.assertFalse(otherObserver.isProcessSessionBean());
+      Assert.assertFalse(otherObserver.isAllProcessSessionBean());
+      
+      Assert.assertTrue(extensionObserver.isAfterDeploymentValidation());
+      Assert.assertTrue(extensionObserver.isAllAfterDeploymentValidation());
+      Assert.assertFalse(otherObserver.isAfterDeploymentValidation());
+      Assert.assertFalse(otherObserver.isAllAfterDeploymentValidation());
+   }
+   
+   @Test
+   public void testInjectionTargetWrapped(Capercaillie capercaillie)
+   {
+      Assert.assertTrue(Woodland.isPostConstructCalled());
+      Assert.assertTrue(WoodlandExtension.isInjectCalled());
+      Assert.assertTrue(WoodlandExtension.isPostConstructCalled());
+      Assert.assertTrue(WoodlandExtension.isPreDestroyCalled());
+      Assert.assertTrue(WoodlandExtension.isProduceCalled());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.inject.Inject;
+
+public class Foo
+{
+   
+   @Inject SimpleExtension simpleExtension;
+   
+   public SimpleExtension getSimpleExtension()
+   {
+      return simpleExtension;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+public class Horse
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,296 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+
+ at ApplicationScoped
+public class OtherObserver
+{
+   
+   private boolean allBeforeBeanDiscovery;
+   private boolean allAfterBeanDiscovery;
+   private boolean allAfterDeploymentValidation;
+   private boolean allProcessBean;
+   private boolean allProcessInjectionTarget;
+   private boolean allProcessManagedBean;
+   private boolean allProcessObserverMethod;
+   private boolean allProcessProducer;
+   private boolean allProcessProducerField;
+   private boolean allProcessProducerMethod;
+   private boolean allProcessSession;
+   private boolean allProcessAnnotatedType;
+   
+   private boolean beforeBeanDiscovery;
+   private boolean afterBeanDiscovery;
+   private boolean afterDeploymentValidation;
+   private boolean processBean;
+   private boolean processInjectionTarget;
+   private boolean processManagedBean;
+   private boolean processObserverMethod;
+   private boolean processProducer;
+   private boolean processProducerField;
+   private boolean processProducerMethod;
+   private boolean processSessionBean;
+   private boolean processAnnotatedType;
+
+   public void observeAll(@Observes Object event)
+   {
+      if (event instanceof BeforeBeanDiscovery)
+      {
+         allBeforeBeanDiscovery = true;
+      }
+      if (event instanceof AfterBeanDiscovery)
+      {
+         allAfterBeanDiscovery = true;
+      }
+      if (event instanceof AfterDeploymentValidation)
+      {
+         allAfterDeploymentValidation = true;
+      }
+      if (event instanceof ProcessBean<?> && !(event instanceof ProcessProducerField<?, ?> || event instanceof ProcessProducerMethod<?, ?> || event instanceof ProcessManagedBean<?> || event instanceof ProcessSessionBean<?>))
+      {
+         allProcessBean = true;
+      }
+      if (event instanceof ProcessInjectionTarget<?>)
+      {
+         allProcessInjectionTarget = true;
+      }
+      if (event instanceof ProcessManagedBean<?>)
+      {
+         allProcessManagedBean = true;
+      }
+      if (event instanceof ProcessObserverMethod<?, ?>)
+      {
+         allProcessObserverMethod = true;
+      }
+      if (event instanceof ProcessProducer<?, ?>)
+      {
+         allProcessProducer = true;
+      }
+      if (event instanceof ProcessProducerField<?, ?>)
+      {
+         allProcessProducerField = true;
+      }
+      if (event instanceof ProcessProducerMethod<?, ?>)
+      {
+         allProcessProducerMethod = true;
+      }
+      if (event instanceof ProcessSessionBean<?>)
+      {
+         allProcessSession = true;
+      }
+      if (event instanceof ProcessAnnotatedType<?>)
+      {
+         allProcessAnnotatedType = true;
+      }
+   }
+   
+   public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
+   {
+      beforeBeanDiscovery = true;
+   }
+   
+   public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
+   {
+      afterBeanDiscovery = true;
+   }
+   
+   public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
+   {
+      afterDeploymentValidation = true;
+   }
+   
+   public void observeProcessBean(@Observes ProcessBean<?> event)
+   {
+      processBean = true;
+   }
+   
+   public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<?> event)
+   {
+      processInjectionTarget = true;
+   }
+   
+   public void observeProcessProducer(@Observes ProcessProducer<?, ?> event)
+   {
+      processProducer = true;
+   }
+   
+   public void observeProcessProducerMethod(@Observes ProcessProducerMethod<?, ?> event)
+   {
+      processProducerMethod = true;
+   }
+   
+   public void observeProcessProducerField(@Observes ProcessProducerField<?, ?> event)
+   {
+      processProducerField = true;
+   }
+   
+   public void observeProcessObserverMethod(@Observes ProcessObserverMethod<?, ?> event)
+   {
+      processObserverMethod = true;
+   }
+   
+   public void observeProcessManagedBean(@Observes ProcessManagedBean<?> event)
+   {
+      processManagedBean = true;
+   }
+   
+   public void observeProcessSessionBean(@Observes ProcessSessionBean<?> event)
+   {
+      processSessionBean = true;
+   }
+   
+   public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType<?> event)
+   {
+      processAnnotatedType = true;
+   }
+
+   public boolean isAllBeforeBeanDiscovery()
+   {
+      return allBeforeBeanDiscovery;
+   }
+
+   public boolean isAllAfterBeanDiscovery()
+   {
+      return allAfterBeanDiscovery;
+   }
+
+   public boolean isAllAfterDeploymentValidation()
+   {
+      return allAfterDeploymentValidation;
+   }
+
+   public boolean isAllProcessBean()
+   {
+      return allProcessBean;
+   }
+
+   public boolean isAllProcessInjectionTarget()
+   {
+      return allProcessInjectionTarget;
+   }
+
+   public boolean isAllProcessManagedBean()
+   {
+      return allProcessManagedBean;
+   }
+
+   public boolean isAllProcessObserverMethod()
+   {
+      return allProcessObserverMethod;
+   }
+
+   public boolean isAllProcessProducer()
+   {
+      return allProcessProducer;
+   }
+
+   public boolean isAllProcessProducerField()
+   {
+      return allProcessProducerField;
+   }
+
+   public boolean isAllProcessProducerMethod()
+   {
+      return allProcessProducerMethod;
+   }
+
+   public boolean isAllProcessSessionBean()
+   {
+      return allProcessSession;
+   }
+
+   public boolean isAllProcessAnnotatedType()
+   {
+      return allProcessAnnotatedType;
+   }
+
+   public boolean isBeforeBeanDiscovery()
+   {
+      return beforeBeanDiscovery;
+   }
+
+   public boolean isAfterBeanDiscovery()
+   {
+      return afterBeanDiscovery;
+   }
+
+   public boolean isAfterDeploymentValidation()
+   {
+      return afterDeploymentValidation;
+   }
+
+   public boolean isProcessBean()
+   {
+      return processBean;
+   }
+
+   public boolean isProcessInjectionTarget()
+   {
+      return processInjectionTarget;
+   }
+
+   public boolean isProcessManagedBean()
+   {
+      return processManagedBean;
+   }
+
+   public boolean isProcessObserverMethod()
+   {
+      return processObserverMethod;
+   }
+
+   public boolean isProcessProducer()
+   {
+      return processProducer;
+   }
+
+   public boolean isProcessProducerField()
+   {
+      return processProducerField;
+   }
+
+   public boolean isProcessProducerMethod()
+   {
+      return processProducerMethod;
+   }
+
+   public boolean isProcessSessionBean()
+   {
+      return processSessionBean;
+   }
+
+   public boolean isProcessAnnotatedType()
+   {
+      return processAnnotatedType;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+public class Rat
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+
+
+public class SimpleExtension implements Extension
+{
+
+   private static boolean observedBeforeBeanDiscovery;
+   
+   public void observe(@Observes BeforeBeanDiscovery event)
+   {
+      observedBeforeBeanDiscovery = true;
+   }
+   
+   public static boolean isObservedBeforeBeanDiscovery()
+   {
+      return observedBeforeBeanDiscovery;
+   }
+   
+   public void observeBeforeShutdown(@Observes BeforeShutdown beforeShutdown, BeanManager beanManager)
+   {
+      assert beanManager != null;
+      assert beanManager.getELResolver() != null;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.enterprise.inject.Produces;
+
+public class Stable
+{
+   
+   @Produces @Special Rat rat = new Rat();
+
+   @Produces @Special Horse produce()
+   {
+      return new Horse();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.inject.Produces;
+
+public class Woodland
+{
+   
+   private static boolean postConstructCalled;
+   
+   @Produces
+   private Capercaillie capercaillie = new Capercaillie("bob");
+   
+   @PostConstruct
+   public void postConstruct()
+   {
+      postConstructCalled = true;
+   }
+   
+   public static boolean isPostConstructCalled()
+   {
+      return postConstructCalled;
+   }
+   
+   public static void reset()
+   {
+      postConstructCalled = false;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+public class WoodlandExtension implements Extension
+{
+   
+   private static boolean injectCalled;
+   private static boolean postConstructCalled;
+   private static boolean preDestroyCalled;
+   private static boolean produceCalled;
+   
+   public void cleanup(@Observes BeforeShutdown shutdown)
+   {
+      reset();
+      Woodland.reset();
+   }
+
+   public void enhanceWoodland(final @Observes ProcessInjectionTarget<Woodland> processWoodland)
+   {
+      final InjectionTarget<Woodland> it = processWoodland.getInjectionTarget();
+      processWoodland.setInjectionTarget(new InjectionTarget<Woodland>()
+      {
+
+         public void inject(Woodland instance, CreationalContext<Woodland> ctx)
+         {
+            injectCalled = true;
+            it.inject(instance, ctx);
+         }
+
+         public void postConstruct(Woodland instance)
+         {
+            postConstructCalled = true;
+            it.postConstruct(instance);
+         }
+
+         public void preDestroy(Woodland instance)
+         {
+            preDestroyCalled = true;
+            it.preDestroy(instance);
+         }
+
+         public void dispose(Woodland instance)
+         {
+            // No-op for class bean
+            
+         }
+
+         public Set<InjectionPoint> getInjectionPoints()
+         {
+            return it.getInjectionPoints();
+         }
+
+         public Woodland produce(CreationalContext<Woodland> ctx)
+         {
+            produceCalled = true;
+            return it.produce(ctx);
+         }
+          
+      });
+   }
+   
+   public static void reset()
+   {
+      injectCalled = false;
+      postConstructCalled = false;
+      preDestroyCalled = false;
+      preDestroyCalled = false;
+   }
+   
+   public static boolean isInjectCalled()
+   {
+      return injectCalled;
+   }
+   
+   public static boolean isPostConstructCalled()
+   {
+      return postConstructCalled;
+   }
+   
+   public static boolean isPreDestroyCalled()
+   {
+      return preDestroyCalled;
+   }
+   
+   public static boolean isProduceCalled()
+   {
+      return produceCalled;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,563 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.inject.Inject;
+
+import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
+import org.jboss.weld.util.collections.Arrays2;
+
+public class AnnotatedTypeExtension implements Extension
+{
+   
+   public void addTumbleDryer(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+   {
+      
+      final Set<AnnotatedConstructor<TumbleDryer>> constructors = new HashSet<AnnotatedConstructor<TumbleDryer>>();
+      final Set<AnnotatedField<? super TumbleDryer>> fields = new HashSet<AnnotatedField<? super TumbleDryer>>();
+      final Set<AnnotatedMethod<? super TumbleDryer>> methods = new HashSet<AnnotatedMethod<? super TumbleDryer>>();
+      
+      final AnnotatedType<TumbleDryer> tumbleDryer = new AnnotatedType<TumbleDryer>()
+      {
+
+         public Set<AnnotatedConstructor<TumbleDryer>> getConstructors()
+         {
+            return constructors;
+         }
+
+         public Set<AnnotatedField<? super TumbleDryer>> getFields()
+         {
+            return fields;
+         }
+         
+         public Set<AnnotatedMethod<? super TumbleDryer>> getMethods()
+         {
+            return methods;
+         }
+         
+         // Now the easy stuff
+
+         public Class<TumbleDryer> getJavaClass()
+         {
+            return TumbleDryer.class;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            // Class has no annotations
+            return null;
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.emptySet();
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            // Class has no annotations
+            return false;
+         }
+         
+      };
+      
+      AnnotatedField<TumbleDryer> plug = new AnnotatedField<TumbleDryer>()
+      {
+
+         public Field getJavaMember()
+         {
+            try
+            {
+               return TumbleDryer.class.getDeclaredField("plug");
+            }
+            catch (NoSuchFieldException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return annotationType.cast(InjectLiteral.INSTANCE);
+            }
+            else if (annotationType.equals(Special.class))
+            {
+               return annotationType.cast(SpecialLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Arrays2.asSet(InjectLiteral.INSTANCE, SpecialLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return Plug.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(Plug.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Inject.class) || annotationType.equals(Special.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+
+         public AnnotatedType<TumbleDryer> getDeclaringType()
+         {
+            return tumbleDryer;
+         }
+      };
+      fields.add(plug);
+      
+      
+      final List<AnnotatedParameter<TumbleDryer>> runningTimeParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
+      final AnnotatedMethod<TumbleDryer> runningTimeMethod = new AnnotatedMethod<TumbleDryer>()
+      {
+
+         public Method getJavaMember()
+         {
+            try
+            {
+               return TumbleDryer.class.getDeclaredMethod("setRunningTime", RunningTime.class);
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public List<AnnotatedParameter<TumbleDryer>> getParameters()
+         {
+            return runningTimeParameters;
+         }
+
+         public AnnotatedType<TumbleDryer> getDeclaringType()
+         {
+            return tumbleDryer;
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return annotationType.cast(InjectLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+         
+      };
+      methods.add(runningTimeMethod);
+      
+      final AnnotatedParameter<TumbleDryer> runningTimeParameter = new AnnotatedParameter<TumbleDryer>()
+      {
+
+         public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
+         {
+            return runningTimeMethod;
+         }
+
+         public int getPosition()
+         {
+            return 0;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return annotationType.cast(SpecialLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return RunningTime.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Collections.<Type>singleton(RunningTime.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+      };
+      runningTimeParameters.add(runningTimeParameter);
+      
+      final List<AnnotatedParameter<TumbleDryer>> clothesParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
+      final AnnotatedConstructor<TumbleDryer> clothesConstructor = new AnnotatedConstructor<TumbleDryer>()
+      {
+
+         public Constructor<TumbleDryer> getJavaMember()
+         {
+            try
+            {
+               return TumbleDryer.class.getDeclaredConstructor(Clothes.class);
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public List<AnnotatedParameter<TumbleDryer>> getParameters()
+         {
+            return clothesParameters;
+         }
+
+         public AnnotatedType<TumbleDryer> getDeclaringType()
+         {
+            return tumbleDryer;
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return annotationType.cast(InjectLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+      };
+      constructors.add(clothesConstructor);
+      
+      AnnotatedParameter<TumbleDryer> clothesParameter = new AnnotatedParameter<TumbleDryer>()
+      {
+
+         public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
+         {
+            return clothesConstructor;
+         }
+
+         public int getPosition()
+         {
+            return 0;
+         }
+
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return annotationType.cast(SpecialLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return Clothes.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(Clothes.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Special.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+      };
+      clothesParameters.add(clothesParameter);
+      
+      beforeBeanDiscovery.addAnnotatedType(tumbleDryer);
+   }
+   
+   /**
+    * Adds an eco friendly wasing machine
+    * @param beforeBeanDiscovery
+    */
+   public void addWashingMachine(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+   {
+      final Set<AnnotatedConstructor<WashingMachine>> constructors = new HashSet<AnnotatedConstructor<WashingMachine>>();
+      final AnnotatedType<WashingMachine> type = new AnnotatedType<WashingMachine>()
+      {
+
+         public Set<AnnotatedConstructor<WashingMachine>> getConstructors()
+         {
+            return constructors;
+         }
+
+         public Set<AnnotatedField<? super WashingMachine>> getFields()
+         {
+            return Collections.emptySet();
+         }
+
+         public Class<WashingMachine> getJavaClass()
+         {
+            return WashingMachine.class;
+         }
+
+         public Set<AnnotatedMethod<? super WashingMachine>> getMethods()
+         {
+            return Collections.emptySet();
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if(annotationType == EcoFriendlyWashingMachine.class)
+            {
+               return annotationType.cast(EcoFriendlyWashingMachineLiteral.INSTANCE);
+            }
+            return null;
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(EcoFriendlyWashingMachineLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+           return WashingMachine.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            return annotationType == EcoFriendlyWashingMachine.class;
+         }
+         
+      };
+      
+      final AnnotatedConstructor<WashingMachine> constructor = new AnnotatedConstructor<WashingMachine>()
+      {
+
+         public Constructor<WashingMachine> getJavaMember()
+         {
+            try
+            {
+               return WashingMachine.class.getDeclaredConstructor();
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public List<AnnotatedParameter<WashingMachine>> getParameters()
+         {
+            return Collections.emptyList();
+         }
+
+         public AnnotatedType<WashingMachine> getDeclaringType()
+         {
+            return type;
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            return null;
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.emptySet();
+         }
+
+         public Type getBaseType()
+         {
+            return WashingMachine.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            return false;
+         }
+      };
+      constructors.add(constructor);
+      
+      beforeBeanDiscovery.addAnnotatedType(type);
+   }
+   
+   public void vetoOriginalTumbleDryer(@Observes ProcessAnnotatedType<TumbleDryer> event)
+   {
+      event.veto();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Set;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class AnnotatedTypeExtensionTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(BeanArchive.class)
+                  .addPackage(AnnotatedTypeExtensionTest.class.getPackage())
+                  .addClass(Utils.class)
+                  .addServiceProvider(Extension.class, AnnotatedTypeExtension.class)
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testMultipleBeansOfSameType(Laundry laundry)
+   {
+      Assert.assertNotNull(laundry.ecoFriendlyWashingMachine);
+      Assert.assertNotNull(laundry.fastWashingMachine);
+   }
+   
+   /*
+    * description = "WELD-371"
+    */
+   @Test
+   public void testAnnotationsAreOverridden()
+   {
+      Bean<WashingMachine> bean = Utils.getBean(beanManager, WashingMachine.class, EcoFriendlyWashingMachineLiteral.INSTANCE);
+      Assert.assertTrue(Utils.annotationSetMatches(bean.getQualifiers(), Any.class, EcoFriendlyWashingMachine.class));
+      
+      // Verify overriding the class structure works
+      Clothes.reset();
+      TumbleDryer tumbleDryer = Utils.getReference(beanManager, TumbleDryer.class);
+      Bean<TumbleDryer> tumbleDryerBean = Utils.getBean(beanManager, TumbleDryer.class);
+      Assert.assertNotNull(tumbleDryer);
+      
+      Assert.assertFalse(containsConstructor(tumbleDryerBean.getInjectionPoints(), SerialNumber.class));
+      Assert.assertTrue(containsConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class));
+      Assert.assertNull(tumbleDryer.getSerialNumber());
+      Assert.assertNotNull(tumbleDryer.getClothes());
+      Assert.assertFalse(Clothes.getInjectionPoint().getAnnotated().isAnnotationPresent(Original.class));
+      AnnotatedConstructor<?> clothesConstructor = getConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class); 
+      Assert.assertTrue(clothesConstructor.getParameters().get(0).isAnnotationPresent(Special.class));
+      Assert.assertFalse(clothesConstructor.getParameters().get(0).isAnnotationPresent(Original.class));
+     
+      Assert.assertTrue(containsField(tumbleDryerBean.getInjectionPoints(), "plug"));
+      Assert.assertFalse(containsField(tumbleDryerBean.getInjectionPoints(), "coins"));
+      Assert.assertNotNull(tumbleDryer.getPlug());
+      Assert.assertNull(tumbleDryer.getCoins());
+      
+      Assert.assertTrue(containsMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class));
+      Assert.assertFalse(containsMethod(tumbleDryerBean.getInjectionPoints(), "setHotAir", HotAir.class));
+      Assert.assertNotNull(tumbleDryer.getRunningTime());
+      Assert.assertNull(tumbleDryer.getHotAir());
+      AnnotatedMethod<?> runningTimeMethod = getMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class);
+      Assert.assertTrue(runningTimeMethod.getParameters().get(0).isAnnotationPresent(Special.class));
+      Assert.assertFalse(runningTimeMethod.getParameters().get(0).isAnnotationPresent(Original.class));
+   }
+   
+   private static boolean containsField(Set<InjectionPoint> injectionPoints, String name)
+   {
+      for (InjectionPoint ip : injectionPoints)
+      {
+         if (ip.getAnnotated() instanceof AnnotatedField<?>)
+         {
+            AnnotatedField<?> field = (AnnotatedField<?>) ip.getAnnotated();
+            if (field.getJavaMember().getName().equals(name))
+            {
+               return true;
+            }
+         }
+      }
+      return false;
+   }
+   
+   private static boolean containsConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
+   {
+      return getConstructor(injectionPoints, parameters) != null;
+   }
+   
+   private static AnnotatedConstructor<?> getConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
+   {
+      for (InjectionPoint ip : injectionPoints)
+      {
+         if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
+         {
+            AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
+            if (param.getDeclaringCallable() instanceof AnnotatedConstructor<?>)
+            {
+               Class<?>[] parameterTypes = ((Constructor<?>) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
+               if (Arrays.equals(parameters, parameterTypes))
+               {
+                  return (AnnotatedConstructor<?>) param.getDeclaringCallable();
+               }
+            }
+         }
+      }
+      return null;
+   }
+   
+   private static boolean containsMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
+   {
+      return getMethod(injectionPoints, name, parameters) != null;
+   }
+   
+   private static AnnotatedMethod<?> getMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
+   {
+      for (InjectionPoint ip : injectionPoints)
+      {
+         if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
+         {
+            AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
+            if (param.getDeclaringCallable() instanceof AnnotatedMethod<?>)
+            {
+               Class<?>[] parameterTypes = ((Method) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
+               String methodName = param.getDeclaringCallable().getJavaMember().getName();
+               if (Arrays.equals(parameters, parameterTypes) && methodName.equals(name))
+               {
+                  return (AnnotatedMethod<?>) param.getDeclaringCallable();
+               }
+            }
+         }
+      }
+      return null;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+ at Special
+public class Clothes
+{
+   
+   private static InjectionPoint injectionPoint;
+   
+   @Inject 
+   public void setInjectionPoint(InjectionPoint injectionPoint)
+   {
+      Clothes.injectionPoint = injectionPoint;
+   }
+   
+   public static void reset()
+   {
+      injectionPoint = null;
+   }
+   
+   public static InjectionPoint getInjectionPoint()
+   {
+      return injectionPoint;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+public class Coins
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+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.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface EcoFriendlyWashingMachine
+{
+   
+   @SuppressWarnings("serial")
+   public static class EcoFriendlyWashingMachineLiteral extends AnnotationLiteral<EcoFriendlyWashingMachine> implements EcoFriendlyWashingMachine 
+   {
+      
+      public static final EcoFriendlyWashingMachine INSTANCE = new EcoFriendlyWashingMachineLiteral();
+      
+      private EcoFriendlyWashingMachineLiteral() {}
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface FastWashingMachine
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+public class HotAir
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+public class InjectLiteral extends AnnotationLiteral<Inject> implements Inject
+{
+   
+   public static final Inject INSTANCE = new InjectLiteral();
+   
+   private InjectLiteral() {}
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.inject.Inject;
+
+public class Laundry
+{
+   @Inject @FastWashingMachine
+   public WashingMachine fastWashingMachine;
+   
+   @Inject @EcoFriendlyWashingMachine
+   public WashingMachine ecoFriendlyWashingMachine;
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Original
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+ at Special
+public class Plug
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+ at Special
+public class RunningTime
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+public class SerialNumber
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Special
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class SpecialLiteral extends AnnotationLiteral<Special> implements Special
+{
+   
+   public static final Special INSTANCE = new SpecialLiteral();
+   
+   private SpecialLiteral() {}
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+import javax.inject.Inject;
+
+
+public class TumbleDryer
+{
+
+   
+   private Plug plug;
+   
+   @Inject @Original
+   private Coins coins;
+   
+   private final Clothes clothers;
+
+   private RunningTime runningTime;
+
+   private final SerialNumber serialNumber;
+
+   private HotAir hotAir;
+   
+   public TumbleDryer(@Original Clothes clothes)
+   {
+      this.clothers = clothes;
+      this.serialNumber = null;
+   }
+   
+   @Inject
+   public TumbleDryer(SerialNumber serialNumber)
+   {
+      this.serialNumber = serialNumber;
+      this.clothers = null;
+   }
+   
+   public void setRunningTime(@Original RunningTime runningTime)
+   {
+      this.runningTime = runningTime;  
+   }
+   
+   @Inject
+   public void setHotAir(HotAir hotAir)
+   {
+      this.hotAir = hotAir;
+   }
+   
+   public Plug getPlug()
+   {
+      return plug;
+   }
+   
+   public Clothes getClothes()
+   {
+      return clothers;
+   }
+   
+   public HotAir getHotAir()
+   {
+      return hotAir;
+   }
+   
+   public RunningTime getRunningTime()
+   {
+      return runningTime;
+   }
+   
+   public SerialNumber getSerialNumber()
+   {
+      return serialNumber;
+   }
+   
+   public Coins getCoins()
+   {
+      return coins;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType;
+
+ at FastWashingMachine
+public class WashingMachine
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeEjbExtension.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeEjbExtension.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeEjbExtension.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+
+public class AnnotatedTypeEjbExtension implements Extension
+{
+   /**
+    * Adds two ejb beans
+    */
+   public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+   {
+      TestAnnotatedTypeBuilder<Lathe> builder = new TestAnnotatedTypeBuilder<Lathe>(Lathe.class);
+      builder.addToClass(new AnnotationLiteral<SmallLathe>() { });
+      beforeBeanDiscovery.addAnnotatedType(builder.create());
+      builder = new TestAnnotatedTypeBuilder<Lathe>(Lathe.class);
+      builder.addToClass(new AnnotationLiteral<BigLathe>() { });
+      beforeBeanDiscovery.addAnnotatedType(builder.create());
+   }
+   /**
+    * Adds annotations to an EJB
+    */
+   public void overrideLatheAnnotations(@Observes ProcessAnnotatedType<Lathe> event) throws SecurityException, NoSuchMethodException
+   {
+     TestAnnotatedTypeBuilder<Lathe> builder = new TestAnnotatedTypeBuilder<Lathe>(Lathe.class);
+     for(Annotation a : event.getAnnotatedType().getAnnotations())
+     {
+        builder.addToClass(a);
+     }
+     Method method = Lathe.class.getMethod("doWork");
+     builder.addToMethod(method, new AnnotationLiteral<ConveyorShaft>() {});
+     builder.addToMethod(method, new AnnotationLiteral<Produces>() {});
+     event.setAnnotatedType(builder.create());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+/**
+ * Tests that it is possible to override ejb annotations through the SPI
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ *
+ */
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class AnnotatedTypeSessionBeanTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(BeanArchive.class)
+                  .addPackage(AnnotatedTypeSessionBeanTest.class.getPackage())
+                  .addPackage(TestAnnotatedTypeBuilder.class.getPackage())
+                  .addServiceProvider(Extension.class, AnnotatedTypeEjbExtension.class)
+         );
+   }
+
+   @Test
+   public void testOverridingEjbAnnotations(@ConveyorShaft Shaft conveyerShaft)
+   {
+      Assert.assertNotNull(conveyerShaft);
+   }
+   
+   @Test
+   public void testAddingBultipleBeansPerEjbClass(@BigLathe LatheLocal bigLathe, @SmallLathe LatheLocal smallLathe)
+   {
+      Assert.assertNotNull(bigLathe);
+      Assert.assertNotNull(smallLathe);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/BigLathe.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/BigLathe.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/BigLathe.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface BigLathe
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/ConveyorShaft.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/ConveyorShaft.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/ConveyorShaft.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface ConveyorShaft
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Lathe.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Lathe.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Lathe.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class Lathe implements LatheLocal
+{
+   public Shaft doWork()
+   {
+      return new Shaft();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/LatheLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/LatheLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/LatheLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+import javax.ejb.Local;
+
+ at Local
+public interface LatheLocal
+{
+
+   public Shaft doWork();
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Shaft.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Shaft.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/Shaft.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+public class Shaft
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/SmallLathe.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/SmallLathe.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/SmallLathe.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.ejb;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface SmallLathe
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtension.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtension.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtension.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,221 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.invalidParameters;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
+
+import org.jboss.weld.util.collections.Arrays2;
+
+public class AnnotatedTypeExtension implements Extension
+{
+   
+   public void addTumbleDryer(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+   {
+      
+      final Set<AnnotatedConstructor<TumbleDryer>> constructors = new HashSet<AnnotatedConstructor<TumbleDryer>>();
+
+      
+      final AnnotatedType<TumbleDryer> tumbleDryer = new AnnotatedType<TumbleDryer>()
+      {
+
+         public Set<AnnotatedConstructor<TumbleDryer>> getConstructors()
+         {
+            return constructors;
+         }
+
+         public Set<AnnotatedField<? super TumbleDryer>> getFields()
+         {
+            return Collections.emptySet();
+         }
+         
+         public Set<AnnotatedMethod<? super TumbleDryer>> getMethods()
+         {
+            return Collections.emptySet();
+         }
+         
+         // Now the easy stuff
+
+         public Class<TumbleDryer> getJavaClass()
+         {
+            return TumbleDryer.class;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            // Class has no annotations
+            return null;
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.emptySet();
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            // Class has no annotations
+            return false;
+         }
+         
+      };
+            
+      final List<AnnotatedParameter<TumbleDryer>> clothesParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
+      final AnnotatedConstructor<TumbleDryer> clothesConstructor = new AnnotatedConstructor<TumbleDryer>()
+      {
+
+         public Constructor<TumbleDryer> getJavaMember()
+         {
+            try
+            {
+               return TumbleDryer.class.getDeclaredConstructor(Clothes.class);
+            }
+            catch (NoSuchMethodException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+
+         public List<AnnotatedParameter<TumbleDryer>> getParameters()
+         {
+            return clothesParameters;
+         }
+
+         public AnnotatedType<TumbleDryer> getDeclaringType()
+         {
+            return tumbleDryer;
+         }
+
+         public boolean isStatic()
+         {
+            return false;
+         }
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return annotationType.cast(InjectLiteral.INSTANCE);
+            }
+            else
+            {
+               return null;
+            }
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
+         }
+
+         public Type getBaseType()
+         {
+            return TumbleDryer.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            if (annotationType.equals(Inject.class))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+         }
+      };
+      constructors.add(clothesConstructor);
+      
+      AnnotatedParameter<TumbleDryer> clothesParameter = new AnnotatedParameter<TumbleDryer>()
+      {
+
+         public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
+         {
+            return clothesConstructor;
+         }
+
+         public int getPosition()
+         {
+            return 0;
+         }
+
+
+         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+         {
+            return null;
+         }
+
+         public Set<Annotation> getAnnotations()
+         {
+            return Collections.emptySet();
+         }
+
+         public Type getBaseType()
+         {
+            return Clothes.class;
+         }
+
+         public Set<Type> getTypeClosure()
+         {
+            return Arrays2.<Type>asSet(Clothes.class, Object.class);
+         }
+
+         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         {
+            return false;
+         }
+      };
+      clothesParameters.add(clothesParameter);
+      clothesParameters.add(clothesParameter);
+      
+      beforeBeanDiscovery.addAnnotatedType(tumbleDryer);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.invalidParameters;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+//@ExpectedDeploymentException(Exception.class)
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class AnnotatedTypeExtensionTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(WebArchive.class, "test.war")
+                  .addWebResource(EmptyAsset.INSTANCE, "beans.xml")
+                  .addPackage(AnnotatedTypeExtensionTest.class.getPackage())
+                  .addServiceProvider(Extension.class, AnnotatedTypeExtension.class);
+   }
+
+   /*
+    * description = "WELD-371"
+    */
+   @Test
+   public void testIncorrectlyOverridenParameters()
+   {
+      assert false;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/Clothes.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/Clothes.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/Clothes.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.invalidParameters;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+public class Clothes
+{
+   
+   private static InjectionPoint injectionPoint;
+   
+   @Inject 
+   public void setInjectionPoint(InjectionPoint injectionPoint)
+   {
+      Clothes.injectionPoint = injectionPoint;
+   }
+   
+   public static void reset()
+   {
+      injectionPoint = null;
+   }
+   
+   public static InjectionPoint getInjectionPoint()
+   {
+      return injectionPoint;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/InjectLiteral.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/InjectLiteral.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/InjectLiteral.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.invalidParameters;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+public class InjectLiteral extends AnnotationLiteral<Inject> implements Inject
+{
+   
+   public static final Inject INSTANCE = new InjectLiteral();
+   
+   private InjectLiteral() {}
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/TumbleDryer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/TumbleDryer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/TumbleDryer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.annotatedType.invalidParameters;
+
+import javax.inject.Inject;
+
+
+
+public class TumbleDryer
+{
+
+   private final Clothes clothers;
+   
+   @Inject
+   public TumbleDryer(Clothes clothes)
+   {
+      this.clothers = clothes;
+   }
+   
+   public Clothes getClothes()
+   {
+      return clothers;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/FullMarathon.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/FullMarathon.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/FullMarathon.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(value = { ElementType.TYPE })
+public @interface FullMarathon
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Incremented.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Incremented.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Incremented.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(value = { ElementType.TYPE, ElementType.METHOD })
+public @interface Incremented
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/IncrementingInterceptor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/IncrementingInterceptor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/IncrementingInterceptor.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+import javax.interceptor.InvocationContext;
+
+/**
+ * Interceptor that adds one to the result of a method
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+public class IncrementingInterceptor
+{
+   private static boolean doAroundCalled = false;
+
+   // @AroundInvoke
+   public Object doAround(InvocationContext context) throws Exception
+   {
+      doAroundCalled = true;
+      Integer res = (Integer)context.proceed();
+      return res + 1;
+   }
+  
+   public static boolean isDoAroundCalled()
+   {
+      return doAroundCalled;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtension.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtension.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtension.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+import java.lang.reflect.Method;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+
+/**
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+public class InterceptorExtension implements Extension
+{
+   /**
+    * registers two interceptors via the SPI
+    */
+   public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager) throws SecurityException, NoSuchMethodException
+   {
+      event.addInterceptorBinding(Incremented.class);
+      event.addInterceptorBinding(FullMarathon.class);
+
+      TestAnnotatedTypeBuilder<IncrementingInterceptor> incBuilder = new TestAnnotatedTypeBuilder<IncrementingInterceptor>(IncrementingInterceptor.class);
+      incBuilder.addToClass(new InterceptorLiteral());
+      incBuilder.addToClass(new IncrementedLiteral());
+
+      Method around = IncrementingInterceptor.class.getMethod("doAround", InvocationContext.class);
+      incBuilder.addToMethod(around, new AroundInvokeLiteral());
+      event.addAnnotatedType(incBuilder.create());
+
+      TestAnnotatedTypeBuilder<LifecycleInterceptor> marBuilder = new TestAnnotatedTypeBuilder<LifecycleInterceptor>(LifecycleInterceptor.class);
+      marBuilder.addToClass(new InterceptorLiteral());
+      marBuilder.addToClass(new FullMarathonImpl());
+
+      Method pre = LifecycleInterceptor.class.getMethod("preDestroy", InvocationContext.class);
+      marBuilder.addToMethod(pre, new PreDestroyLiteral());
+
+      Method post = LifecycleInterceptor.class.getMethod("postConstruct", InvocationContext.class);
+      marBuilder.addToMethod(post, new PostConstructLiteral());
+
+      event.addAnnotatedType(marBuilder.create());
+
+   }
+
+   private static class InterceptorLiteral extends AnnotationLiteral<Interceptor> implements Interceptor
+   {
+   };
+
+   private static class IncrementedLiteral extends AnnotationLiteral<Incremented> implements Incremented
+   {
+   };
+
+   private static class AroundInvokeLiteral extends AnnotationLiteral<AroundInvoke> implements AroundInvoke
+   {
+   };
+
+   private static class PreDestroyLiteral extends AnnotationLiteral<PreDestroy> implements PreDestroy
+   {
+   };
+
+   private static class PostConstructLiteral extends AnnotationLiteral<PostConstruct> implements PostConstruct
+   {
+   };
+
+   private static class FullMarathonImpl extends AnnotationLiteral<FullMarathon> implements FullMarathon
+   {
+   };
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests that interceptors registered via the SPI work correctly
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class InterceptorExtensionTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(BeanArchive.class)
+                  .intercept(IncrementingInterceptor.class, LifecycleInterceptor.class)
+                  .addPackage(InterceptorExtensionTest.class.getPackage())
+                  .addPackage(TestAnnotatedTypeBuilder.class.getPackage())
+                  .addServiceProvider(Extension.class, InterceptorExtension.class)
+         );
+   }
+   
+   @Inject
+   private BeanManager beanManager;
+   
+   @Test
+   public void testInterceptorCalled(NumberSource ng)
+   {
+      Assert.assertEquals(1, ng.value());
+      Assert.assertTrue(IncrementingInterceptor.isDoAroundCalled());
+   }
+
+   @Test
+   @SuppressWarnings("unchecked")
+   public void testLifecycleInterceptor()
+   {
+      Bean bean = beanManager.getBeans(Marathon.class).iterator().next();
+      CreationalContext creationalContext = beanManager.createCreationalContext(bean);
+      Marathon m = (Marathon)bean.create(creationalContext);
+      
+      Assert.assertTrue(LifecycleInterceptor.isPostConstructCalled());
+      Assert.assertEquals(24, m.getLength());
+      bean.destroy(m, creationalContext);
+      Assert.assertTrue(LifecycleInterceptor.isPreDestroyCalled());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/LifecycleInterceptor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/LifecycleInterceptor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/LifecycleInterceptor.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+import javax.interceptor.InvocationContext;
+
+/**
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+public class LifecycleInterceptor
+{
+   static private boolean preDestroyCalled = false;
+   static private boolean postConstructCalled = false;
+
+   // PreDestroy
+   public void preDestroy(InvocationContext ctx)
+   {
+      preDestroyCalled = true;
+   }
+
+   // @PostConstruct
+   public void postConstruct(InvocationContext ctx)
+   {
+      Object marathon = ctx.getTarget();
+      if (marathon instanceof Marathon)
+      {
+         Marathon m = (Marathon) marathon;
+         m.setLength(42);
+      }
+      postConstructCalled = true;
+   }
+
+   static public boolean isPostConstructCalled()
+   {
+      return postConstructCalled;
+   }
+
+   static public boolean isPreDestroyCalled()
+   {
+      return preDestroyCalled;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Marathon.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Marathon.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/Marathon.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+ at FullMarathon
+public class Marathon
+{
+   long length;
+
+   public long getLength()
+   {
+      return length;
+   }
+
+   public void setLength(long length)
+   {
+      this.length = length;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/NumberSource.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/NumberSource.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/NumberSource.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.interceptors;
+
+/**
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+public class NumberSource
+{
+   @Incremented
+   public int value()
+   {
+      return 1;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Author.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Author.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Author.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.FIELD, ElementType.TYPE, ElementType.METHOD })
+public @interface Author
+{
+   public String name();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/AuthorLiteral.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/AuthorLiteral.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/AuthorLiteral.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/**
+ * 
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+class AuthorLiteral extends AnnotationLiteral<Author> implements Author
+{
+
+   final String name;
+
+   AuthorLiteral(String name)
+   {
+      this.name = name;
+   }
+
+   public String name()
+   {
+      return name;
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import javax.inject.Inject;
+
+ at Consumer(name = "Barry")
+public class BlogConsumer
+{
+   @Inject
+   @FormattedBlog(name = "Barry")
+   public String blogContent;
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogFormatter.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogFormatter.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogFormatter.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+public class BlogFormatter
+{
+   @Inject
+   @Author(name = "Barry")
+   public String content;
+
+   @Produces
+   @FormattedBlog(name = "Barry")
+   public String format()
+   {
+      return "+" + content + "+";
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogSource.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogSource.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/BlogSource.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import javax.enterprise.inject.Produces;
+
+public class BlogSource
+{
+   @Produces
+   @Author(name = "Barry")
+   String barrysBlog = "Barry's content";
+
+   @Produces
+   @Author(name = "Bob")
+   String bobsBlog = "Bob's content";
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Consumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Consumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/Consumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.FIELD, ElementType.TYPE, ElementType.METHOD })
+public @interface Consumer
+{
+   public String name();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/ConsumerLiteral.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/ConsumerLiteral.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/ConsumerLiteral.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/**
+ * 
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+class ConsumerLiteral extends AnnotationLiteral<Consumer> implements Consumer
+{
+
+   final String name;
+
+   ConsumerLiteral(String name)
+   {
+      this.name = name;
+   }
+
+   public String name()
+   {
+      return name;
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlog.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlog.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlog.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.FIELD, ElementType.TYPE, ElementType.METHOD })
+public @interface FormattedBlog
+{
+   public String name();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlogLiteral.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlogLiteral.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/FormattedBlogLiteral.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/**
+ * 
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+class FormattedBlogLiteral extends AnnotationLiteral<FormattedBlog> implements FormattedBlog
+{
+
+   final String name;
+
+   FormattedBlogLiteral(String name)
+   {
+      this.name = name;
+   }
+
+   public String name()
+   {
+      return name;
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansExtension.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansExtension.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansExtension.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+
+/**
+ * Extension that registers addition types via the SPI
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+public class MultipleBeansExtension implements Extension
+{
+
+   public void addNewAnnotatedTypes(@Observes BeforeBeanDiscovery event) throws SecurityException, NoSuchFieldException, NoSuchMethodException
+   {
+      TestAnnotatedTypeBuilder<BlogFormatter> formatter = new TestAnnotatedTypeBuilder<BlogFormatter>(BlogFormatter.class);
+      Field content = BlogFormatter.class.getField("content");
+      formatter.addToField(content, new InjectLiteral());
+      formatter.addToField(content, new AuthorLiteral("Bob"));
+      Method format = BlogFormatter.class.getMethod("format");
+      formatter.addToMethod(format, new ProducesLiteral());
+      formatter.addToMethod(format, new FormattedBlogLiteral("Bob"));
+      event.addAnnotatedType(formatter.create());
+
+      TestAnnotatedTypeBuilder<BlogConsumer> consumer = new TestAnnotatedTypeBuilder<BlogConsumer>(BlogConsumer.class);
+      consumer.addToClass(new ConsumerLiteral("Bob"));
+      content = BlogConsumer.class.getField("blogContent");
+      consumer.addToField(content, new InjectLiteral());
+      consumer.addToField(content, new FormattedBlogLiteral("Bob"));
+      event.addAnnotatedType(consumer.create());
+
+      // two beans that are exactly the same
+      // this is not very useful, however should still work
+      TestAnnotatedTypeBuilder<UselessBean> uselessBuilder = new TestAnnotatedTypeBuilder<UselessBean>(UselessBean.class);
+      event.addAnnotatedType(uselessBuilder.create());
+
+   }
+
+   private static class InjectLiteral extends AnnotationLiteral<Inject> implements Inject
+   {
+
+   }
+
+   private static class ProducesLiteral extends AnnotationLiteral<Produces> implements Produces
+   {
+
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests that it is possible to add multiple beans with the same java class type
+ * through the SPI
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class MultipleBeansTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(BeanArchive.class)
+                  .addPackage(MultipleBeansTest.class.getPackage())
+                  .addPackage(TestAnnotatedTypeBuilder.class.getPackage())
+                  .addClass(Utils.class)
+                  .addServiceProvider(Extension.class, MultipleBeansExtension.class)
+         );
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void testFormatterRegistered()
+   {
+      // test that we have added two beans with the same qualifiers
+      Assert.assertEquals(2, Utils.getBeans(beanManager, BlogFormatter.class).size());
+      // test that the beans which have different producer methods produce
+      // different values
+      Assert.assertEquals("+Bob's content+", Utils.getReference(beanManager, String.class, new FormattedBlogLiteral("Bob")));
+      Assert.assertEquals("+Barry's content+", Utils.getReference(beanManager, String.class, new FormattedBlogLiteral("Barry")));
+   }
+
+   @Test
+   public void testBlogConsumed()
+   {
+      // test that the two different BlogConsumers have been registered
+      // correctly
+      BlogConsumer consumer = Utils.getReference(beanManager, BlogConsumer.class, new ConsumerLiteral("Barry"));
+      Assert.assertEquals("+Barry's content+", consumer.blogContent);
+      consumer = Utils.getReference(beanManager, BlogConsumer.class, new ConsumerLiteral("Bob"));
+      Assert.assertEquals("+Bob's content+", consumer.blogContent);
+   }
+
+   /**
+    * Apparently it is not possible to add two beans that are exactly the same.
+    * Even though this is not very useful it should still be possible.
+    * 
+    */
+   @Test
+   @Category(Broken.class)
+   public void testTwoBeansExactlyTheSame()
+   {
+      Assert.assertEquals(2, beanManager.getBeans(UselessBean.class).size());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/UselessBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/UselessBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/UselessBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.extensions.multipleBeans;
+
+/**
+ * 
+ * 
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ * 
+ */
+public class UselessBean
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+public class Cow
+{
+   
+   private final String name;
+
+   public Cow(String name)
+   {
+      this.name = name;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.injection.FieldInjectionPoint;
+
+public class CowShed
+{
+
+   @Produces
+   public Cow get(InjectionPoint ip)
+   {
+      assert ip instanceof FieldInjectionPoint<?, ?>;
+      FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) ip;
+      assert fip.getDeclaringType().getJavaClass().equals(Field.class);
+      return new Cow("daisy");
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+ at Named
+ at SessionScoped
+public class DoubleConsumer implements Serializable
+{
+
+   private static final long serialVersionUID = 6619645042310126425L;
+
+   @Inject
+   private double maxNumber;
+
+   public DoubleConsumer()
+   {
+   }
+   
+   public void ping()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+import java.util.Timer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+public class DoubleGenerator implements Serializable
+{
+
+   private static final long serialVersionUID = -7213673465118041882L;
+   
+   @Inject Timer timer;
+   
+   @Produces
+   double getDouble()
+   {
+      timer.cancel();
+      return 11.1;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface ExtraSpecial
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.injectionPoint;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class ExtraSpecialLiteral extends AnnotationLiteral<ExtraSpecial> implements ExtraSpecial
+{
+    public static final ExtraSpecial INSTANCE = new ExtraSpecialLiteral();
+
+    private ExtraSpecialLiteral() {
+    }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import javax.inject.Inject;
+
+public class Field
+{
+   
+   @Inject Cow cow;
+   
+   public Cow getCow()
+   {
+      return cow;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+public class GrassyField extends Field
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import java.lang.reflect.ParameterizedType;
+
+import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class InjectionPointTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(InjectionPointTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   /*
+    * description = "WELD-239"
+    */
+   @Test
+   public void testCorrectInjectionPointUsed(IntConsumer intConsumer, DoubleConsumer doubleConsumer)
+   {
+      intConsumer.ping();
+      
+      try
+      {
+         doubleConsumer.ping();
+      }
+      catch (IllegalProductException e)
+      {
+         Assert.assertTrue(e.getMessage().contains("Injection Point: field org.jboss.weld.tests.injectionPoint.DoubleGenerator.timer"));
+      }
+   }
+   
+   /*
+    * description = "WELD-316"
+    */
+   @Test
+   public void testFieldInjectionPointSerializability(StringConsumer consumer) throws Throwable
+   {
+      consumer.ping();
+      InjectionPoint ip = StringGenerator.getInjectionPoint();
+      Assert.assertNotNull(ip);
+      Assert.assertEquals("str", ip.getMember().getName());
+      InjectionPoint ip1 = Utils.deserialize(Utils.serialize(ip));
+      Assert.assertEquals("str", ip1.getMember().getName());
+   }
+   
+   @Test
+   public void testGetDeclaringType(GrassyField field)
+   {
+      Assert.assertEquals("daisy", field.getCow().getName());
+   }
+   
+   /*
+    * description = "WELD-438"
+    */
+   @Test
+   public void testInjectionPointWhenInstanceGetIsUsed(PigSty pigSty) throws Exception
+   {
+      Pig pig = pigSty.getPig();
+      Assert.assertNotNull(pig);
+      Assert.assertNotNull(pig.getInjectionPoint().getBean());
+      Assert.assertEquals(PigSty.class, pig.getInjectionPoint().getBean().getBeanClass());
+      Assert.assertEquals(PigSty.class.getDeclaredField("pig"), pig.getInjectionPoint().getMember());
+      Assert.assertNotNull(pig.getInjectionPoint().getAnnotated());
+      Assert.assertTrue(pig.getInjectionPoint().getAnnotated().getBaseType() instanceof ParameterizedType);
+      ParameterizedType parameterizedType = ((ParameterizedType) pig.getInjectionPoint().getAnnotated().getBaseType());
+      Assert.assertEquals(Instance.class, parameterizedType.getRawType());
+      Assert.assertEquals(1, parameterizedType.getActualTypeArguments().length);
+      Assert.assertEquals(Pig.class, parameterizedType.getActualTypeArguments()[0]);
+      Assert.assertTrue(pig.getInjectionPoint().getAnnotated().isAnnotationPresent(Special.class));
+      Assert.assertFalse(pig.getInjectionPoint().getAnnotated().isAnnotationPresent(ExtraSpecial.class));
+      Assert.assertTrue(Utils.annotationSetMatches(pig.injectionPoint.getQualifiers(), Special.class, ExtraSpecial.class));
+      Assert.assertEquals(Pig.class, pig.getInjectionPoint().getType());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+ at Named
+ at SessionScoped
+public class IntConsumer implements Serializable
+{
+
+   private static final long serialVersionUID = 6619645042310126425L;
+
+   @Inject
+   private int maxNumber;
+
+   public IntConsumer()
+   {
+   }
+   
+   public void ping()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+import java.util.Timer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+public class IntGenerator implements Serializable
+{
+
+   private static final long serialVersionUID = -7213673465118041882L;
+
+   @Inject
+   private Instance<Timer> timerInstance;
+
+   @Produces
+   int getInt()
+   {
+      // This has no purpose other than to invoke a method on the proxy so that the proxy instance
+      // is retrieved via the producer method
+      timerInstance.get().cancel();
+      return 100;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+ at Special @ExtraSpecial
+public class Pig
+{
+   
+   @Inject InjectionPoint injectionPoint;
+   
+   public InjectionPoint getInjectionPoint()
+   {
+      return injectionPoint;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class PigSty
+{
+   @Inject @Special Instance<Pig> pig;
+   
+   public Pig getPig()
+   {
+      return pig.select(ExtraSpecialLiteral.INSTANCE).get();
+   }
+   
+}
+

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import javax.inject.Inject;
+
+public class StringConsumer
+{
+
+   @Inject String str;
+   
+   public void ping() {}
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class StringGenerator
+{
+
+   private static InjectionPoint injectionPoint;
+   
+   public static InjectionPoint getInjectionPoint()
+   {
+      return injectionPoint;
+   }
+   
+   public static void reset()
+   {
+      injectionPoint = null;
+   }
+   
+   @Produces String getString(InjectionPoint ip)
+   {
+      injectionPoint = ip;
+      return "";
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+import java.util.Timer;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+public class TimerManager implements Serializable
+{
+
+   private static final long serialVersionUID = 5156835887786174326L;
+
+   @Produces
+   @RequestScoped
+   public Timer getTimer()
+   {
+      return new Timer();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/other/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/other/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/other/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.injectionPoint.other;
+
+public class Foo
+{
+
+   public void ping() {}
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,13 @@
+package org.jboss.weld.tests.producer.field;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+ at Retention(RetentionPolicy.RUNTIME)
+ at Qualifier
+public @interface Baz
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Inject;
+
+public class IntegerCollectionInjection
+{
+
+   private Collection<Integer> value;
+
+   @Inject
+   private Collection<Integer> fieldInjection;
+
+   private Collection<Integer> setterInjection;
+
+   @Inject
+   public void init(Collection<Integer> setterInjection)
+   {
+      this.setterInjection = setterInjection;
+   }
+
+   @Inject
+   public IntegerCollectionInjection(Collection<Integer> com)
+   {
+      this.value = com;
+   }
+
+   public Collection<Integer> getValue()
+   {
+      return value;
+   }
+
+   public Collection<Integer> getFieldInjection()
+   {
+      return fieldInjection;
+   }
+
+   public Collection<Integer> getSetterInjection()
+   {
+      return setterInjection;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.List;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class ListInstance
+{
+   @Inject @Any
+   Instance<List> instance;
+   
+   public Instance<List> get()
+   {
+      return instance;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.List;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class ListStringInstance
+{
+   @Inject @Any Instance<List<String>> instance;
+
+   public List<String> get()
+   {
+      return instance.get();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Inject;
+
+public class ParameterizedCollectionInjection
+{
+
+   private Collection<String> value;
+
+   @Inject
+   private Collection<String> fieldInjection;
+
+   private Collection<String> setterInjection;
+
+   @Inject
+   public void init(Collection<String> setterInjection)
+   {
+      this.setterInjection = setterInjection;
+   }
+
+   @Inject
+   public ParameterizedCollectionInjection(Collection<String> com)
+   {
+      this.value = com;
+   }
+
+   public Collection<String> getValue()
+   {
+      return value;
+   }
+
+   public Collection<String> getFieldInjection()
+   {
+      return fieldInjection;
+   }
+
+   public Collection<String> getSetterInjection()
+   {
+      return setterInjection;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+public class ParameterizedListInjection
+{
+
+   private List<String> value;
+
+   @Inject
+   private List<String> fieldInjection;
+
+   private List<String> setterInjection;
+
+   @Inject
+   public void init(List<String> setterInjection)
+   {
+      this.setterInjection = setterInjection;
+   }
+
+   @Inject
+   public ParameterizedListInjection(List<String> com)
+   {
+      this.value = com;
+   }
+
+   public java.util.List<String> getValue()
+   {
+      return value;
+   }
+
+   public List<String> getFieldInjection()
+   {
+      return fieldInjection;
+   }
+
+   public List<String> getSetterInjection()
+   {
+      return setterInjection;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+
+public class ParameterizedProducer
+{
+
+   @Produces
+   public List<String> createStringList()
+   {
+      return Arrays.asList("aaa", "bbb");
+   }
+
+   @Produces
+   public ArrayList<Integer> createIntegerList()
+   {
+      List<Integer> list = Arrays.asList(1, 2, 3, 4);
+      ArrayList<Integer> arrayList = new ArrayList<Integer>();
+      arrayList.addAll(list);
+      return arrayList;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ParameterizedProducerTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ParameterizedProducerTest.class.getPackage());
+   }
+
+   @Test
+   public void testParameterizedListInjection(Target target, ParameterizedListInjection item)
+   {
+      List<String> strings = target.getStringList();
+      Assert.assertEquals(2, strings.size());
+
+      Assert.assertEquals(2, item.getFieldInjection().size());
+      Assert.assertEquals(2, item.getValue().size());
+      Assert.assertEquals(2, item.getSetterInjection().size());
+
+   }
+
+   @Test
+   public void testParameterizedCollectionInjection(Target target, ParameterizedCollectionInjection item)
+   {
+      Collection<String> strings = target.getStrings();
+      Assert.assertEquals(2, strings.size());
+
+      Assert.assertEquals(2, item.getFieldInjection().size());
+      Assert.assertEquals(2, item.getValue().size());
+      Assert.assertEquals(2, item.getSetterInjection().size() );
+   }
+   
+   @Test
+   public void testIntegerCollectionInjection(Target target, IntegerCollectionInjection item)
+   {
+      Collection<Integer> integers = target.getIntegers();
+      Assert.assertEquals(4, integers.size());
+
+      Assert.assertEquals(4, item.getFieldInjection().size());
+      Assert.assertEquals(4, item.getValue().size());
+      Assert.assertEquals(4, item.getSetterInjection().size());
+
+   }
+   
+   @Test
+   public void testInstanceList(ListInstance listInstance)
+   {
+        Assert.assertTrue(listInstance.get().isAmbiguous());
+   }
+   
+   @Test
+   public void testTypeParameterInstance(ListStringInstance listInstance)
+   {
+        Assert.assertEquals(2, listInstance.get().size());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Simple test which invokes a method directly on a normal scoped producer
+ * bean to ensure that it's proxy is for that bean and not the product
+ * of a producer method.
+ * 
+ * @author David Allen
+ *
+ */
+ at RunWith(Arquillian.class)
+public class ProducerBeanInvocationTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ProducerBeanInvocationTest.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-546"
+    */
+   @Test
+   public void test(Qux bar, QuxProducer producer, @Baz Qux bazBar)
+   {
+      Assert.assertEquals("qux", bar.getBar());
+      Assert.assertTrue(producer.ping());
+      Assert.assertEquals("baz", bazBar.getBar());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+package org.jboss.weld.tests.producer.field;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+public class Qux
+{
+   
+   private final String name;
+   
+   public Qux(String name)
+   {
+      this.name = name;
+   }
+   
+   public Qux()
+   {
+      this("qux");
+   }
+   
+   public String getBar()
+   {
+      return name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,18 @@
+package org.jboss.weld.tests.producer.field;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+ at RequestScoped
+public class QuxProducer
+{
+   
+   @Produces @Baz @RequestScoped
+   private Qux bar = new Qux("baz");
+   
+   public boolean ping() 
+   {
+      return true;
+   };
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.field;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.inject.Inject;
+
+public class Target
+{
+   
+   @Inject private Collection<String> strings;
+   
+   @Inject private Collection<Integer> integers;
+   
+   @Inject private List<String> stringList;
+   
+   public Collection<String> getStrings()
+   {
+      return strings;
+   }
+   
+   public Collection<Integer> getIntegers()
+   {
+      return integers;
+   }
+   
+   public List<String> getStringList()
+   {
+      return stringList;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+public class Bar
+{
+
+   public Bar(String blah)
+   {
+      
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+ at RequestScoped
+public class BarConsumer
+{
+   @Inject
+   private Bar bar;
+
+   public Bar getBar()
+   {
+      return bar;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import java.lang.reflect.Member;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+/**
+ * Class with a producer method and disposal method both containing InjectionPoint
+ * parameters.
+ * 
+ * @author David Allen
+ *
+ */
+public class BarProducer
+{
+   private static Bar disposedBar;
+   private static Member disposedInjection;
+   private static Member producedInjection;
+   
+   @Produces
+   public Bar getBar(InjectionPoint injectionPoint)
+   {
+      producedInjection = injectionPoint.getMember();
+      return new Bar("blah");
+   }
+   
+   public void dispose(@Disposes @Any Bar bar, InjectionPoint injectionPoint)
+   {
+      disposedBar = bar;
+      disposedInjection = injectionPoint.getMember();
+   }
+
+   public static Bar getDisposedBar()
+   {
+      return disposedBar;
+   }
+
+   public static Member getDisposedInjection()
+   {
+      return disposedInjection;
+   }
+
+   public static Member getProducedInjection()
+   {
+      return producedInjection;
+   }
+   
+   public static void reset()
+   {
+      disposedBar = null;
+      disposedInjection = null;
+      producedInjection = null;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,13 @@
+package org.jboss.weld.tests.producer.method;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+ at Retention(RetentionPolicy.RUNTIME)
+ at Qualifier
+public @interface Baz
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import java.io.Serializable;
+
+public class Car implements Serializable
+{
+
+   private static final long serialVersionUID = 1L;
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+
+public class CarFactory
+{
+
+   @Produces @Important
+   public Car produceGovernmentCar()
+   {
+      return null;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class DisposalMethodInjectionPointTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(DisposalMethodInjectionPointTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   /*
+    * description = "WELD-358"
+    */
+   @Test
+   @Category(Broken.class)
+   public void test()
+   {
+      BarProducer.reset();
+      Bean<BarConsumer> barConsumerBean = Utils.getBean(beanManager, BarConsumer.class);
+      CreationalContext<BarConsumer> ctx = beanManager.createCreationalContext(barConsumerBean);
+      BarConsumer barConsumer = barConsumerBean.create(ctx);
+      Assert.assertEquals("bar", BarProducer.getProducedInjection().getName());
+      Bar bar = barConsumer.getBar();
+      barConsumerBean.destroy(barConsumer, ctx);
+      Assert.assertEquals(bar, BarProducer.getDisposedBar());
+      Assert.assertEquals("bar", BarProducer.getDisposedInjection().getName());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class DisposalMethodOnOtherBeanNotResolvedTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(DisposalMethodOnOtherBeanNotResolvedTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void test()
+   {
+      FooDisposer.reset();
+      FooProducer.reset();
+      Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+      CreationalContext<Foo> ctx = beanManager.createCreationalContext(bean);
+      Foo instance = bean.create(ctx);
+      Assert.assertEquals("foo!", instance.getBlah());
+      bean.destroy(instance, ctx);
+      Assert.assertFalse(FooDisposer.isDisposed());
+      Assert.assertTrue(FooProducer.isDisposed());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+   
+   private final String blah;
+   
+   public Foo(String blah)
+   {
+      this.blah = blah;
+   }
+
+   /**
+    * @return the blah
+    */
+   public String getBlah()
+   {
+      return blah;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author pmuir
+ *
+ */
+public class FooDisposer
+{
+
+   private static boolean disposed;
+   
+   public static void reset()
+   {
+      disposed = false;
+   }
+   
+   void disposeFoo(@Disposes @Any Foo foo)
+   {
+      disposed = true;
+   }
+   
+   /**
+    * @return the disposed
+    */
+   public static boolean isDisposed()
+   {
+      return disposed;
+   }
+   
+   @Produces @Important
+   public Foo getFoo()
+   {
+      return new Foo("bar!");
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author pmuir
+ *
+ */
+public class FooProducer
+{
+
+   @Produces Foo getFoo()
+   {
+      return new Foo("foo!");
+   }
+   
+   private static boolean disposed;
+   
+   public static void reset()
+   {
+      disposed = false;
+   }
+   
+   public void disposeFoo(@Disposes Foo foo)
+   {
+      disposed = true;
+   }
+   
+   /**
+    * @return the disposed
+    */
+   public static boolean isDisposed()
+   {
+      return disposed;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+ at SessionScoped
+public class Government implements Serializable
+{
+
+   private static final long serialVersionUID = 1L;
+
+   @Important Car governmentCar;
+   
+   public void destabilize()
+   {
+      
+   }
+   
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+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.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author Dan Allen
+ */
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at Inherited
+public @interface Important {
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.inject.Inject;
+
+public class IntInjection
+{
+   
+   int value;
+   
+   @Inject public IntInjection(Integer integer)
+   {
+      this.value = integer;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+public class JmsTemplate
+{
+   
+   private final int receiveTimeout;
+   
+   public JmsTemplate(int receiveTimeout)
+   {
+      this.receiveTimeout = receiveTimeout;
+   }
+   
+   public int getReceiveTimeout()
+   {
+      return receiveTimeout;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class JmsTemplateConfigurationProducer
+{
+   
+   public static final int LONG_RECEIVE_TIMEOUT = 3 * 3600;
+   public static final int SHORT_RECEIVE_TIMEOUT = 100;
+
+   @Produces @Long
+   private int longReceiveTimeout = LONG_RECEIVE_TIMEOUT;
+   
+   @Produces @Short
+   private int shortReceiveTimeout = SHORT_RECEIVE_TIMEOUT;
+
+   @Produces
+   @Named
+   public JmsTemplate getErrorQueueTemplate(@Long int receiveTimeout)
+   {
+      return new JmsTemplate(receiveTimeout);
+   }
+
+   @Produces
+   @Named
+   public JmsTemplate getLogQueueTemplate(@Short int receiveTimeout)
+   {
+      return new JmsTemplate(receiveTimeout);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+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.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author Dan Allen
+ */
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at Inherited
+public @interface Long {
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+class ManagerProducer
+{
+   
+   @Inject BeanManager beanManager;
+   
+   private static boolean injectionPointInjected;
+   
+   public static boolean isInjectionPointInjected()
+   {
+      return injectionPointInjected;
+   }
+   
+   public static void setInjectionPointInjected(boolean injectionPointInjected)
+   {
+      ManagerProducer.injectionPointInjected = injectionPointInjected;
+   }
+
+   @Produces
+   Integer create(InjectionPoint point)
+   {
+      injectionPointInjected = point != null;
+      return 10;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ManagerProducerTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ManagerProducerTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   /*
+    * description = "WBRI-183"
+    */
+   @Test
+   public void testInjectManagerProducer()
+   {
+      ManagerProducer.setInjectionPointInjected(false);
+      Utils.getReference(beanManager, IntInjection.class);
+      Assert.assertTrue(ManagerProducer.isInjectionPointInjected());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class NamedProducer
+{
+   @Named("itoen")
+   @Produces
+   public String[] createName()
+   {
+      return new String[] { "oh", "otya" };
+   }
+
+   @Named("iemon")
+   @Produces
+   public String[] createName2()
+   {
+      return new String[] { "fukujyuen", "iemon", "otya" };
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class NamedProducerTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(NamedProducerTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+
+   @Test
+   public void testNamedProducer()
+   {
+      Bean<?> iemonBean = beanManager.resolve(beanManager.getBeans("iemon"));
+      String[] iemon = (String[]) beanManager.getReference(iemonBean, Object.class, beanManager.createCreationalContext(iemonBean));
+      Assert.assertEquals(3, iemon.length);
+      Bean<?> itoenBean = beanManager.resolve(beanManager.getBeans("itoen"));
+      String[] itoen = (String[]) beanManager.getReference(itoenBean, Object.class, beanManager.createCreationalContext(itoenBean));
+      Assert.assertEquals(2, itoen.length);
+   }
+   
+   @Test
+   public void testDefaultNamedProducerMethod() 
+   {
+      Set<Bean<?>> beans = beanManager.getBeans(JmsTemplate.class);
+      Assert.assertEquals(2, beans.size());
+      List<String> beanNames = new ArrayList<String>(Arrays.asList("errorQueueTemplate", "logQueueTemplate"));
+      for (Bean<?> b : beans)
+      {
+         beanNames.remove(b.getName());
+      }
+      Assert.assertTrue(beanNames.isEmpty());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import java.util.Date;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+/**
+ * @author Dan Allen
+ */
+public class NamedProducerWithBinding {
+   public @Produces @Important @Named Date getDate() {
+      return new Date();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import java.util.Date;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Dan Allen
+ */
+ at RunWith(Arquillian.class)
+public class NamedProducerWithBindingTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(NamedProducerWithBindingTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testGetNamedProducerWithBinding()
+   {
+      Bean<?> bean = beanManager.resolve(beanManager.getBeans("date"));
+      Date date = (Date) beanManager.getReference(bean, Object.class, beanManager.createCreationalContext(bean));
+      Assert.assertNotNull(date);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class NullProducerTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(NullProducerTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   /*
+    * description = "WBRI-276"
+    */
+   @Test
+   public void testProducerMethodReturnsNull(Government government)
+   {
+      government.destabilize();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Simple test which invokes a method directly on a normal scoped producer
+ * bean to ensure that it's proxy is for that bean and not the product
+ * of a producer method.
+ * 
+ * @author David Allen
+ *
+ */
+ at RunWith(Arquillian.class)
+public class ProducerBeanInvocationTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ProducerBeanInvocationTest.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-546"
+    */
+   @Test
+   public void test(Qux bar, QuxProducer producer, @Baz Qux bazBar)
+   {
+      Assert.assertEquals("qux", bar.getBar());
+      Assert.assertTrue(producer.ping());
+      Assert.assertEquals("baz", bazBar.getBar());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+public class Qux
+{
+   
+   private final String name;
+   
+   public Qux(String name)
+   {
+      this.name = name;
+   }
+   
+   public Qux()
+   {
+      this("qux");
+   }
+   
+   public String getBar()
+   {
+      return name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,21 @@
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+ at RequestScoped
+public class QuxProducer
+{
+   
+   @Produces @Baz @RequestScoped
+   public Qux getQux()
+   {
+      return new Qux("baz");
+   }
+   
+   public boolean ping() 
+   {
+      return true;
+   };
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method;
+
+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.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author Dan Allen
+ */
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at Inherited
+public @interface Short {
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.circular;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+class Bar {
+
+    @Inject void injectFoo(Foo foo) {}
+    @Produces Foo produceFoo() { return new Foo() {}; }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.circular;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class CircularInjectionTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(CircularInjectionTest.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-310"
+    */
+   @Test
+   public void testProducerCalledOnBeanUnderConstruction()
+   {
+      
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.circular;
+
+public abstract class Foo
+{
+
+   
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.parameterized;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RUNTIME)
+ at Target( { PARAMETER, METHOD, FIELD, TYPE })
+public @interface Parameterized
+{
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized1.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized1.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized1.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.parameterized;
+
+public class Parameterized1<T>
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized2.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized2.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/Parameterized2.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.parameterized;
+
+public class Parameterized2<T>
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.parameterized;
+
+import javax.enterprise.inject.Produces;
+
+public class ParameterizedProducer
+{
+
+   @Produces
+   @Parameterized
+   public Parameterized1<Parameterized2<Double>> getParameterized()
+   {
+      return new Parameterized1();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.parameterized;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ParameterizedTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ParameterizedTest.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-452"
+    */
+   @Test
+   public void testEventQualifiersCorrect(TestBean testBean)
+   {
+      Assert.assertNotNull(testBean);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/TestBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/TestBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/TestBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.producer.method.parameterized;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+public class TestBean
+{
+   @Inject
+   @Parameterized
+   Parameterized1<Parameterized2<Double>> parameterized;
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+ at Named
+ at RequestScoped
+class Foo implements Serializable
+{
+   
+   public String getMsg()
+   {
+      return "Hi";
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ProxyTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ProxyTest.class.getPackage());
+   }
+   
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   /*
+    * description = "WBRI-122"
+    */
+   @Test
+   public void testImplementationClassImplementsSerializable()
+   {
+      Bean<?> bean = beanManager.resolve(beanManager.getBeans("foo"));
+      Assert.assertNotNull(beanManager.getReference(bean, Object.class, beanManager.createCreationalContext(bean)));
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy.enterprise;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class EnterpriseBeanProxyTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(EnterpriseBeanProxyTest.class.getPackage())
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+   
+   /*
+    * description = "WBRI-109"
+    * 
+    * <a href="https://jira.jboss.org/jira/browse/WBRI-109">WBRI-109</a>
+    */
+   // Broken due to WELDINT-45
+   @Test
+   @Category(Broken.class)
+   public void testNoInterfaceView(Mouse mouse) throws Exception
+   {
+      Assert.assertTrue(Utils.isProxy(mouse));
+      Assert.assertTrue(mouse instanceof Mouse);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/Mouse.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/Mouse.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/Mouse.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy.enterprise;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class Mouse
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Baz.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Baz.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Baz.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,6 @@
+package org.jboss.weld.tests.proxy.observer;
+
+public class Baz
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,39 @@
+package org.jboss.weld.tests.proxy.observer;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ObserverInjectionTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ObserverInjectionTest.class.getPackage());
+   }
+
+   @Inject 
+   private BeanManagerImpl beanManager;
+   
+   /*
+    * description = "WELD-535"
+    */
+   @Test
+   public void testInjectionHappens(SampleObserver sampleObserver)
+   {
+      Assert.assertFalse(sampleObserver.isInjectionAndObservationOccured());
+      beanManager.fireEvent(new Baz());
+      Assert.assertTrue(sampleObserver.isInjectionAndObservationOccured());
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Qux.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Qux.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/Qux.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,13 @@
+package org.jboss.weld.tests.proxy.observer;
+
+import java.io.Serializable;
+
+public class Qux implements Serializable
+{
+
+   /**
+    * 
+    */
+   private static final long serialVersionUID = -947946956903414048L;
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/SampleObserver.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/SampleObserver.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/SampleObserver.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+package org.jboss.weld.tests.proxy.observer;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+
+ at SessionScoped
+public class SampleObserver implements Serializable
+{
+
+   private static final long serialVersionUID = -8311790045944819159L;
+
+   @Inject
+   private Qux qux;
+   
+   private boolean injectionAndObservationOccured;
+
+   @SuppressWarnings("unused")
+   private void observes(@Observes Baz baz)
+   {
+      injectionAndObservationOccured = qux != null;
+   }
+   
+   public boolean isInjectionAndObservationOccured()
+   {
+      return injectionAndObservationOccured;
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/InjectedClass.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/InjectedClass.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/InjectedClass.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.proxy.weld477;
+
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class InjectedClass
+{
+   @Inject ScopedClass dependency;
+
+   public ScopedClass getDependency()
+   {
+      return dependency;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy.weld477;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at RunWith(Arquillian.class)
+public class ProxiabilityTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ProxiabilityTest.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-477"
+    */
+   @Test
+   public void testClassWithPrivateFinalMethodsProxyable(InjectedClass injectedClassInstance)
+   {
+       Assert.assertNotNull(injectedClassInstance.getDependency());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ScopedClass.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ScopedClass.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ScopedClass.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.proxy.weld477;
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at ApplicationScoped
+public class ScopedClass
+{
+   private final void privateMethod()
+   {
+
+   }
+                                           
+   public void publicMethod()
+   {
+
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy.weld56;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+public class Bar
+{
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy.weld56;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+
+ at RequestScoped
+public class Foo
+{
+
+   @Inject
+   public Foo(Bar bar)
+   {
+   }
+
+   public String ping()
+   {
+      return "ping";
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.proxy.weld56;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class ProxyTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(WebArchive.class, "test.war")
+               .addPackage(ProxyTest.class.getPackage())
+               .addWebResource(EmptyAsset.INSTANCE, "beans.xml")
+               .addWebResource(EmptyAsset.INSTANCE, "classes/META-INF/org.jboss.weld.enableUnsafeProxies");
+   }
+
+   @Test
+   public void testProxy(Foo foo)
+   {
+      Assert.assertEquals("ping", foo.ping());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+public class Bar
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+public class Baz
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+public class Foo extends FooBase<Bar>
+{
+
+   public String getName()
+   {
+      return "foo";
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+public class FooBase<T>
+{
+   
+   public String getName()
+   {
+      return "foobase";
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+import javax.enterprise.inject.Produces;
+
+public class FooProducer
+{
+   
+   @Produces @Special
+   public FooBase<Baz> produce()
+   {
+      return new FooBase<Baz>();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+import javax.inject.Inject;
+
+public class LookupFoo
+{
+
+   @Inject Foo foo;
+   
+   @Inject @Special FooBase<Baz> foobaz;
+   
+   public Foo getFoo()
+   {
+      return foo;
+   }
+   
+   public FooBase<Baz> getFoobaz()
+   {
+      return foobaz;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+import java.util.List;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.util.TypeLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class LookupInstanceTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(LookupInstanceTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testLookupInstance() throws Exception
+   {
+      Assert.assertNull(
+            Utils.getReference(
+                  beanManager, 
+                  new TypeLiteral<Instance<List<?>>>(){}.getRawType(), DefaultLiteral.INSTANCE)); 
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class Weld256Test 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(Weld256Test.class.getPackage());
+   }
+
+   @Test
+   public void testParameterizedInjection(LookupFoo lookupFoo)
+   {
+      Assert.assertEquals("foo", lookupFoo.getFoo().getName());
+      Assert.assertEquals("foobase", lookupFoo.getFoobaz().getName());
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+class Bar
+{
+   
+   public static boolean success;
+   
+   @Inject Foo foo;
+   
+   public Bar()
+   {
+      success = false;
+   }
+   
+   @PostConstruct
+   public void postConstruct()
+   {
+      if (foo.getName().equals("foo"))
+      {
+         success = true;
+      }
+   }
+   
+   public String getName()
+   {
+      return "bar";
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class CircularDependencyTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(CircularDependencyTest.class.getPackage());
+   }
+
+   @Test
+   public void testCircularInjectionOnTwoSimpleDependentBeans(Foo foo) throws Exception
+   {
+      foo.getName();
+      Assert.assertTrue(Foo.success);
+      Assert.assertTrue(Bar.success);
+   }
+   
+   @Test
+   public void testDependentProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean(DependentSelfConsumingDependentProducer producer) throws Exception
+   {
+      producer.ping();
+   }
+   
+   @Test
+   public void testDependentSelfConsumingProducer(Violation violation) throws Exception
+   {
+      violation.ping();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface DependentLooping
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.enterprise.inject.Produces;
+
+class DependentLoopingProducer
+{
+   
+   @Produces @DependentLooping
+   public Violation produceViolation(@DependentLooping Violation violation) {
+      return new Violation();
+   }
+
+} 
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.enterprise.inject.Produces;
+
+class DependentSelfConsumingDependentProducer
+{
+   @SelfConsumingDependent Violation violation;
+   
+   @Produces @SelfConsumingDependent
+   public Violation produceViolation() {
+      return new Violation();
+   }
+   
+   public void ping() {
+      
+   }
+} 
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.inject.Inject;
+
+class Farm
+{
+   
+   @Inject
+   public Farm(Farm farm)
+   {
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.inject.Inject;
+
+class Fish
+{
+   
+   private Water water;
+   
+   @Inject
+   public Fish(Water water)
+   {
+      this.water = water;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+class Foo
+{
+   
+   public static boolean success;
+   
+   @Inject Bar bar;
+   
+   public Foo()
+   {
+      success = false;
+   }
+   
+   @PostConstruct
+   public void postConstruct()
+   {
+      if (bar.getName().equals("bar"))
+      {
+         success = true;
+      }
+   }
+   
+   public String getName()
+   {
+      return "foo";
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface NormalLooping
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+ at ApplicationScoped
+class NormalLoopingProducer
+{
+   
+   @Produces @ApplicationScoped @NormalLooping
+   public Violation produceViolation(@NormalLooping Violation violation) {
+      return new Violation();
+   }
+
+} 
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface SelfConsumingDependent
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import java.io.Serializable;
+
+class Violation implements Serializable
+{
+   
+   public void ping()
+   {
+      
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular;
+
+import javax.inject.Inject;
+
+class Water
+{
+   @Inject
+   public Water(Fish fish)
+   {
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/Baz.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/Baz.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/Baz.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular.resource;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class Baz
+{
+
+   @Produces @FooDB @PersistenceContext private EntityManager db;
+   @Inject @FooDB EntityManager fooDb; 
+   
+   public EntityManager getFooDb()
+   {
+      return fooDb;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/FooDB.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/FooDB.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/FooDB.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular.resource;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface FooDB
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.circular.resource;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class ResourceCircularDependencyTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ResourceCircularDependencyTest.class.getPackage())
+         .addManifestResource(
+               ResourceCircularDependencyTest.class.getPackage(), "persistence.xml", "persistence.xml");
+   }
+   
+   @Test
+   public void testResourceProducerField(Baz baz) throws Exception
+   {
+      Assert.assertTrue(baz.getFooDb().isOpen());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/FooBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/FooBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/FooBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.named;
+
+import javax.inject.Named;
+
+ at Named("foo")
+public class FooBean
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/Important.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/Important.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/Important.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.named;
+
+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.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author Dan Allen
+ */
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at Inherited
+public @interface Important {
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.named;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+
+public class NamedBeanConsumer
+{
+   
+   @Inject @Named FooBean foo;
+   
+   public FooBean getFoo()
+   {
+      return foo;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.named;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Dan Allen
+ */
+ at RunWith(Arquillian.class)
+public class NamedBeanTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(NamedBeanTest.class.getPackage());
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   public void testGetNamedBeanWithBinding()
+   {
+      Bean<?> bean = beanManager.resolve(beanManager.getBeans("namedBeanWithBinding"));
+      NamedBeanWithBinding instance = (NamedBeanWithBinding) beanManager.getReference(bean, Object.class, beanManager.createCreationalContext(bean));
+      Assert.assertNotNull(instance);
+   }
+   
+   /*
+    * description = "WELD-435"
+    */
+   @Test
+   public void testNamedInjectedFieldUsesFieldName(NamedBeanConsumer consumer)
+   {
+      Assert.assertNotNull(consumer.getFoo());
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanWithBinding.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanWithBinding.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanWithBinding.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.named;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+/**
+ * @author Dan Allen
+ */
+public
+ at Named
+ at Important
+ at RequestScoped
+class NamedBeanWithBinding {
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/AbstractFactory.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/AbstractFactory.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/AbstractFactory.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri279;
+
+public abstract class AbstractFactory<T>
+{
+
+   public abstract T createObject();
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/DummyParent.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/DummyParent.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/DummyParent.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri279;
+
+public class DummyParent
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntFactory.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntFactory.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntFactory.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri279;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { TYPE, FIELD, METHOD, PARAMETER })
+ at Qualifier
+public @interface IntFactory
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntegerFactory.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntegerFactory.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/IntegerFactory.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri279;
+
+ at IntFactory
+public class IntegerFactory extends AbstractFactory<Integer>
+{
+
+   public static final Integer VALUE = 123;
+   
+   public Integer createObject()
+   {
+      return VALUE;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/SomeBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/SomeBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/SomeBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri279;
+
+import javax.inject.Inject;
+
+public class SomeBean
+{
+
+   @Inject @IntFactory
+   IntegerFactory integerFactory;
+
+   public String getObjectAsString()
+   {
+      return integerFactory.createObject().toString();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri279;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author pmuir
+ *
+ */
+ at RunWith(Arquillian.class)
+public class Weld279Test 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(Weld279Test.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-279"
+    */
+   @Test
+   public void testLookupOfGenericTypeSubclass(SomeBean bean)
+   {
+      Assert.assertEquals(IntegerFactory.VALUE.toString(), bean.getObjectAsString());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri293;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author Jozef Hartinger
+ *
+ */
+ at RunWith(Arquillian.class)
+public class ContextualReferenceTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ContextualReferenceTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+
+   @Inject
+   private BeanManagerImpl beanManager;
+   
+   @Test
+   @Category(Broken.class)
+   public void testReferencesEqual() {
+      Sheep sheep = Utils.getReference(beanManager, Sheep.class);
+      sheep.setAge(10);
+      Sheep sheep2 = Utils.getReference(beanManager, Sheep.class);
+      Assert.assertEquals(sheep.getAge(), sheep2.getAge());
+      Assert.assertEquals(sheep, sheep2);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/Sheep.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/Sheep.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/Sheep.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resolution.wbri293;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class Sheep
+{
+   private int age = 0;
+
+   public int getAge()
+   {
+      return age;
+   }
+
+   public void setAge(int age)
+   {
+      this.age = age;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resources;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at Category(Integration.class)
+ at RunWith(Arquillian.class)
+public class ResourceTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ResourceTest.class.getPackage());
+   }
+   
+   /*
+    * description = "WELD-385"
+    */
+   @Test
+   public void testUTInjectedByResource(UTConsumer consumer)
+   {
+      Assert.assertNotNull(consumer.getUserTransaction());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/UTConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/UTConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/UTConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.resources;
+
+import javax.annotation.Resource;
+import javax.transaction.UserTransaction;
+
+public class UTConsumer
+{
+
+   @Resource
+   UserTransaction userTransaction;
+   
+   public UserTransaction getUserTransaction()
+   {
+      return userTransaction;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+import javax.enterprise.context.Dependent;
+
+ at Dependent
+class Bar extends Foo
+{
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class Foo
+{
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.beanstore.HashMapBeanStore;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ScopeTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(ScopeTest.class.getPackage())
+         .addClass(Utils.class);
+   }
+   
+   private static Annotation USELESS_LITERAL = new AnnotationLiteral<Useless>() {};
+   private static Annotation SPECIAL_LITERAL = new AnnotationLiteral<Special>() {};
+   
+   @Inject 
+   private BeanManagerImpl beanManager;
+   
+   /*
+    * description = "WELD-322"
+    */
+   @Test
+   public void testScopeDeclaredOnSubclassOverridesScopeOnSuperClass()
+   {
+      Assert.assertEquals(Dependent.class, beanManager.resolve(beanManager.getBeans(Bar.class)).getScope());
+   }
+   
+   /*
+    * description = "WELD-311"
+    */
+   @Test
+   public void testScopeOfProducerMethod()
+   {
+      Bean<Temp> specialTempBean = Utils.getBean(beanManager, Temp.class, SPECIAL_LITERAL);
+      Bean<Temp> uselessTempBean = Utils.getBean(beanManager, Temp.class, USELESS_LITERAL);
+      Assert.assertEquals(RequestScoped.class, specialTempBean.getScope());
+      Assert.assertEquals(RequestScoped.class, uselessTempBean.getScope());
+      Assert.assertEquals(10, Utils.getReference(beanManager, specialTempBean).getNumber());
+      Assert.assertEquals(11, Utils.getReference(beanManager, uselessTempBean).getNumber());
+      
+      TempConsumer tempConsumer = Utils.getReference(beanManager, TempConsumer.class);
+      tempConsumer.getSpecialTemp().setNumber(101);
+      tempConsumer.getUselessTemp().setNumber(102);
+      
+      Assert.assertEquals(101, tempConsumer.getSpecialTemp().getNumber());
+      Assert.assertEquals(102, tempConsumer.getUselessTemp().getNumber());
+      Assert.assertEquals(101, Utils.getReference(beanManager, specialTempBean).getNumber());
+      Assert.assertEquals(102, Utils.getReference(beanManager, uselessTempBean).getNumber());
+      
+      newRequest();
+      
+      Assert.assertEquals(10, tempConsumer.getSpecialTemp().getNumber());
+      Assert.assertEquals(11, tempConsumer.getUselessTemp().getNumber());
+      Assert.assertEquals(10, Utils.getReference(beanManager, specialTempBean).getNumber());
+      Assert.assertEquals(11, Utils.getReference(beanManager, uselessTempBean).getNumber());
+   }
+   
+   private void newRequest()
+   {
+      ContextLifecycle lifecycle = Container.instance().services().get(ContextLifecycle.class);
+      lifecycle.endRequest("test", lifecycle.getRequestContext().getBeanStore());
+      lifecycle.restoreSession("test", new HashMapBeanStore());
+      lifecycle.beginRequest("test", new HashMapBeanStore());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+public class Temp
+{
+   
+   private int number;
+   
+   public Temp(int number)
+   {
+      this.number = number;
+   }
+   
+   public Temp()
+   {
+      number = 0;
+   }
+   
+   public int getNumber()
+   {
+      return number;
+   }
+   
+   public void setNumber(int number)
+   {
+      this.number = number;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+public class TempConsumer
+{
+
+   @Inject @Special Temp specialTemp;
+   @Inject @Useless Temp uselessTemp;
+   
+   public Temp getSpecialTemp()
+   {
+      return specialTemp;
+   }
+   
+   public Temp getUselessTemp()
+   {
+      return uselessTemp;
+   }
+   
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+ at Named
+ at SessionScoped
+public class TempProducer implements Serializable
+{
+
+   @Produces
+   @RequestScoped
+   @Special
+   public Temp getTemp()
+   {
+      return new Temp(10);
+   }
+
+   @Produces
+   @RequestScoped
+   @Useless
+   Temp t = new Temp(11);
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.scope;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Useless
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerConsumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerConsumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerConsumer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.serialization;
+
+import java.io.Serializable;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+ at SessionScoped
+public class LoggerConsumer implements Serializable
+{
+   
+   @Inject Logger log;
+   
+   public void ping()
+   {
+      
+   }
+   
+   public Logger getLog()
+   {
+      return log;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/LoggerProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.serialization;
+
+import java.util.logging.Logger;
+
+import javax.enterprise.inject.Produces;
+
+public class LoggerProducer
+{
+
+   @Produces
+   public Logger produceLogger()
+   {
+      return Logger.getLogger("foo");
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/Mock.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/Mock.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/Mock.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.serialization;
+
+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.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at Inherited
+public @interface Mock {
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.serialization;
+
+import java.io.Serializable;
+
+import javax.enterprise.inject.IllegalProductException;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class SerializationTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(SerializationTest.class.getPackage());
+   }
+
+   /*
+    * description = "WELD-363"
+    */
+   @Test
+   public void testConversationManagerSerializable(@Mock TestConversationManager cMgr)
+      throws Exception
+   {
+      Assert.assertNotNull(cMgr.getConversationInstance());
+      
+      Object deserialized = Utils.deserialize(Utils.serialize(cMgr));
+      
+      Assert.assertTrue(deserialized instanceof TestConversationManager);
+      TestConversationManager deserializedCMgr = (TestConversationManager) deserialized;
+      Assert.assertNotNull(deserializedCMgr.getConversationInstance());
+   }
+   
+   /*
+    * description = "http://lists.jboss.org/pipermail/weld-dev/2010-February/002265.html"
+    */
+   @Test
+   public void testNonSerializableProductInjectedIntoSessionScopedBean(LoggerConsumer consumer)
+   {
+      try
+      {
+         consumer.ping();
+      }
+      catch (Exception e) 
+      {
+         // If Logger isn't serializable, we get here 
+         Assert.assertTrue(e instanceof IllegalProductException);
+         return;
+      }
+      // If Logger is serializable we get here
+      Assert.assertTrue(consumer.getLog() instanceof Serializable);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.serialization;
+
+import java.lang.reflect.Field;
+
+import org.jboss.weld.conversation.AbstractConversationManager;
+import org.jboss.weld.conversation.ConversationImpl;
+import org.jboss.weld.conversation.ServletConversationManager;
+
+ at Mock
+public class TestConversationManager extends ServletConversationManager
+{
+   private static final long serialVersionUID = 2;
+   
+   public ConversationImpl getConversationInstance() throws Exception
+   {
+      Field ccField = AbstractConversationManager.class.getDeclaredField("conversation");
+      ccField.setAccessible(true);
+      return (ConversationImpl) ccField.get(this);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.session.newBean;
+
+import java.util.Set;
+
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.NewSessionBean;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.introspector.WeldAnnotated;
+import org.jboss.weld.literal.NewLiteral;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class NewEnterpriseBeanTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+         .addModule(
+               ShrinkWrap.create(JavaArchive.class)
+                  .addPackage(NewEnterpriseBeanTest.class.getPackage())
+                  .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+         );
+   }
+   
+   private static final New NEW_LITERAL = new NewLiteral()
+   {
+      @Override
+      public java.lang.Class<?> value() 
+      {
+         return WrappedEnterpriseBean.class;
+      }
+      
+   };
+
+   @Inject 
+   private BeanManager beanManager;
+   
+   private SessionBean<WrappedEnterpriseBeanLocal> wrappedEnterpriseBean;
+   private NewSessionBean<WrappedEnterpriseBeanLocal> newEnterpriseBean;
+   
+   public void initNewBean() 
+   {
+      Set<Bean<?>> beans = beanManager.getBeans(WrappedEnterpriseBeanLocal.class);
+      Assert.assertEquals(1, beanManager.getBeans(WrappedEnterpriseBeanLocal.class).size());
+      Assert.assertTrue(beanManager.getBeans(WrappedEnterpriseBeanLocal.class).iterator().next() instanceof SessionBean<?>);
+      wrappedEnterpriseBean = (SessionBean<WrappedEnterpriseBeanLocal>) beanManager.getBeans(WrappedEnterpriseBeanLocal.class).iterator().next();
+      
+      Assert.assertEquals(1, beanManager.getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).size());
+      Assert.assertTrue(beanManager.getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next() instanceof NewSessionBean<?>);
+      newEnterpriseBean = (NewSessionBean<WrappedEnterpriseBeanLocal>) beanManager.getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next();
+   }
+   
+   @Test
+   @Category(Broken.class)
+   public void testNewBeanHasImplementationClassOfInjectionPointType()
+   {
+      initNewBean();
+      Assert.assertEquals(WrappedEnterpriseBean.class, newEnterpriseBean.getType());
+   }
+
+   @Test
+   public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
+   {
+      initNewBean();
+      Assert.assertEquals(wrappedEnterpriseBean.getInitializerMethods(), newEnterpriseBean.getInitializerMethods());
+   }
+
+   @Test
+   public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
+   {
+      initNewBean();
+      Set<? extends WeldAnnotated<?, ?>> wrappedBeanInjectionPoints = wrappedEnterpriseBean.getWeldInjectionPoints();
+      Set<? extends WeldAnnotated<?, ?>> newBeanInjectionPoints = newEnterpriseBean.getWeldInjectionPoints();
+      Assert.assertEquals(wrappedBeanInjectionPoints, newBeanInjectionPoints);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.session.newBean;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.enterprise.context.SessionScoped;
+
+ at SessionScoped
+ at Stateful
+class WrappedEnterpriseBean implements WrappedEnterpriseBeanLocal
+{
+   @Remove
+   public void bye() {
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBeanLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBeanLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/WrappedEnterpriseBeanLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.session.newBean;
+
+import javax.ejb.Local;
+
+ at Local
+public interface WrappedEnterpriseBeanLocal
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Animal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Animal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Animal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.stereotypes;
+
+interface Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalOrderStereotype.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalOrderStereotype.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalOrderStereotype.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.stereotypes;
+
+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.enterprise.inject.Stereotype;
+
+
+
+ at Stereotype
+ at Target( { TYPE })
+ at Retention(RUNTIME)
+ at interface AnimalOrderStereotype
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalStereotype.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalStereotype.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/AnimalStereotype.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.stereotypes;
+
+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.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Stereotype;
+
+ at Stereotype
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at RequestScoped
+ at interface AnimalStereotype
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Order.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Order.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/Order.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.stereotypes;
+
+
+class Order
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/RequestScopedAnimalStereotype.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/RequestScopedAnimalStereotype.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/RequestScopedAnimalStereotype.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.stereotypes;
+
+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.enterprise.inject.Stereotype;
+
+ at Stereotype
+ at Target( { TYPE })
+ at Retention(RUNTIME)
+public @interface RequestScopedAnimalStereotype
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.stereotypes;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.metadata.cache.StereotypeModel;
+import org.jboss.weld.resources.ClassTransformer;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class StereotypesTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class)
+         .addPackage(StereotypesTest.class.getPackage());
+   }
+	
+   private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
+	
+   @Test
+   public void testAnimalStereotype()
+   {
+      StereotypeModel<AnimalStereotype> animalStereotype = new StereotypeModel<AnimalStereotype>(AnimalStereotype.class, transformer);
+      Assert.assertEquals(RequestScoped.class, animalStereotype.getDefaultScopeType().annotationType());
+      Assert.assertEquals(0, animalStereotype.getInterceptorBindings().size());
+      Assert.assertFalse(animalStereotype.isBeanNameDefaulted());
+      Assert.assertFalse(animalStereotype.isAlternative());
+   }
+   
+   @Test
+   public void testAnimalOrderStereotype()
+   {
+      StereotypeModel<AnimalOrderStereotype> animalStereotype = new StereotypeModel<AnimalOrderStereotype>(AnimalOrderStereotype.class, transformer);
+      Assert.assertNull(animalStereotype.getDefaultScopeType());
+      Assert.assertEquals(0, animalStereotype.getInterceptorBindings().size());
+      Assert.assertFalse(animalStereotype.isBeanNameDefaulted());
+      Assert.assertFalse(animalStereotype.isAlternative());
+   }
+   
+   @Test
+   public void testRequestScopedAnimalStereotype()
+   {
+      StereotypeModel<RequestScopedAnimalStereotype> animalStereotype = new StereotypeModel<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class, transformer);
+      Assert.assertNull(animalStereotype.getDefaultScopeType());
+      Assert.assertEquals(0, animalStereotype.getInterceptorBindings().size());
+      Assert.assertFalse(animalStereotype.isBeanNameDefaulted());
+      Assert.assertFalse(animalStereotype.isAlternative());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Bar
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+import org.jboss.weld.injection.spi.InjectionContext;
+import org.jboss.weld.injection.spi.InjectionServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class CheckableInjectionServices implements InjectionServices
+{
+
+   private boolean before = false;
+   private boolean after = false;
+   private boolean injectedAfter = false;
+   private boolean injectionTargetCorrect = false;
+   
+   public <T> void aroundInject(InjectionContext<T> injectionContext)
+   {
+      before = true;
+      if (injectionContext.getTarget() instanceof Foo)
+      {
+         ((Foo) injectionContext.getTarget()).message = "hi!";
+         if (injectionContext.getInjectionTarget().getInjectionPoints().size() == 1)
+         {
+            injectionTargetCorrect = injectionContext.getInjectionTarget().getInjectionPoints().iterator().next().getType().equals(Bar.class);
+         }
+      }
+      injectionContext.proceed();
+      after = true;
+      if (injectionContext.getTarget() instanceof Foo)
+      {
+         Foo foo = (Foo) injectionContext.getTarget();
+         injectedAfter = foo.getBar() instanceof Bar && foo.getMessage().equals("hi!");
+      }
+   }
+   
+   public void reset()
+   {
+      before = false;
+      after = false;
+      injectedAfter = false;
+      injectionTargetCorrect = false;
+   }
+
+   public boolean isBefore()
+   {
+      return before;
+   }
+
+   public boolean isAfter()
+   {
+      return after;
+   }
+
+   public boolean isInjectedAfter()
+   {
+      return injectedAfter;
+   }
+   
+   public boolean isInjectionTargetCorrect()
+   {
+      return injectionTargetCorrect;
+   }
+
+   public void cleanup() {}
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.ContainerState;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ContainerStatusTest
+{
+   
+   @Test
+   public void testStatus()
+   {
+      TestContainer container = new TestContainer(new MockServletLifecycle());
+      Assert.assertFalse(Container.available());
+      container.getLifecycle().initialize();
+      Assert.assertFalse(Container.available());
+      Assert.assertEquals(ContainerState.STARTING, Container.instance().getState());
+      container.getLifecycle().getBootstrap().startInitialization();
+      Assert.assertFalse(Container.available());
+      Assert.assertEquals(ContainerState.STARTING, Container.instance().getState());
+      container.getLifecycle().getBootstrap().deployBeans();
+      Assert.assertTrue(Container.available());
+      Assert.assertEquals(ContainerState.INITIALIZED, Container.instance().getState());
+      container.getLifecycle().getBootstrap().validateBeans().endInitialization();
+      Assert.assertTrue(Container.available());
+      Assert.assertEquals(ContainerState.VALIDATED, Container.instance().getState());
+      container.stopContainer();
+      Assert.assertFalse(Container.available());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+import org.jboss.weld.bootstrap.WeldBootstrap;
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.junit.Test;
+
+public class DiscoverFailsBootstrapTest
+{
+   
+   @Test(expected = IllegalArgumentException.class)
+   public void testDiscoverFails()
+   {
+      Bootstrap bootstrap = new WeldBootstrap();
+      bootstrap.startContainer(Environments.SE, null, new ConcurrentHashMapBeanStore());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+import javax.inject.Inject;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+   
+   @Inject
+   private Bar bar;
+   
+   public String message;
+   
+   /**
+    * @return the bar
+    */
+   public Bar getBar()
+   {
+      return bar;
+   }
+   
+   /**
+    * @return the message
+    */
+   public String getMessage()
+   {
+      return message;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+import java.util.Arrays;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.injection.spi.InjectionServices;
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InjectionServicesTest
+{
+   
+   @Test
+   public void testInjectionOfTarget()
+   {
+      TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
+      CheckableInjectionServices ijs = new CheckableInjectionServices();
+      container.getLifecycle().getWar().getServices().add(InjectionServices.class, ijs);
+      container.startContainer();
+      container.ensureRequestActive();
+      
+      BeanManager manager = container.getBeanManager();
+      
+      Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
+      ijs.reset();
+      Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));
+      
+      Assert.assertTrue(ijs.isBefore());
+      Assert.assertTrue(ijs.isAfter());
+      Assert.assertTrue(ijs.isInjectedAfter());
+      Assert.assertTrue(ijs.isInjectionTargetCorrect());
+      
+      Assert.assertNotNull(foo.getBar());
+      Assert.assertEquals("hi!", foo.getMessage());
+      
+      
+      container.stopContainer();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author kkhan
+ *
+ */
+public class PreinstantiateBeanManagerTest
+{
+
+   @Test
+   public void test()
+   {
+      //Start the container, but do not deploy weld yet
+      List<Class<?>> classes = new ArrayList<Class<?>>();
+      classes.add(WeldBean.class);
+      TestContainer container = new TestContainer(new MockEELifecycle(), classes, null);
+      container.getLifecycle().initialize();
+      
+      BeanManager bootstrapManager = container.getBeanManager();
+      Assert.assertNotNull(bootstrapManager);
+
+      //Check the bean is null since it is not there yet
+      Set<Bean<?>> beans = bootstrapManager.getBeans(WeldBean.class);
+      Assert.assertNotNull(beans);
+      Assert.assertEquals(0, beans.size());
+      
+      //Start the application
+      container.getLifecycle().beginApplication();
+      container.ensureRequestActive();
+      
+      //Check the manager is the same as before
+      BeanManager manager = container.getBeanManager();
+      Assert.assertNotNull(manager);
+      Assert.assertEquals(bootstrapManager, manager);
+      
+      //Check we can get the bean
+      Bean<? extends Object> bean = manager.resolve(manager.getBeans(WeldBean.class));
+      WeldBean weldBean = (WeldBean) manager.getReference(bean, WeldBean.class, manager.createCreationalContext(bean));
+      Assert.assertNotNull(weldBean);
+      
+      container.stopContainer();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */ 
+package org.jboss.weld.tests.unit.bootstrap;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class WeldBean
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap;
+
+import java.util.Arrays;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+public class WeldStartupTest
+{
+
+   @Test
+   public void test()
+   {
+      TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
+      container.startContainer();
+      container.ensureRequestActive();
+      
+      BeanManager manager = container.getBeanManager();
+      
+      Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
+      Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));
+      
+      Assert.assertNotNull(foo);
+      Assert.assertNotNull(foo.getBar());
+      
+      container.stopContainer();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Alt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Alt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Alt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap.xml;
+
+import javax.enterprise.inject.Alternative;
+
+ at Alternative
+public class Alt
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,219 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap.xml;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.weld.logging.messages.XmlMessage;
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.xml.WeldXmlException;
+import org.junit.Assert;
+import org.junit.Test;
+
+ at SuppressWarnings("unchecked")
+public class BeansXmlTest
+{
+   private static class FailedDeployment
+   {
+      private List<Class<?>> beans = Collections.emptyList();
+      private List<URL> beansXml = Collections.emptyList();
+
+      public FailedDeployment(List<Class<?>> beans, List<URL> beansXml)
+      {
+         this.beans = beans;
+         this.beansXml = beansXml;
+      }
+
+      public void run()
+      {
+         TestContainer container = null;
+         try
+         {
+            container = new TestContainer(new MockEELifecycle(), beans, beansXml).startContainer().ensureRequestActive();
+         }
+         finally
+         {
+            if (container != null)
+            {
+               container.stopContainer();
+            }
+         }
+      }
+
+      public void runAndExpect(WeldXmlException expected)
+      {
+         String errorCode = expected.getMessage().substring(0, 11);
+         try
+         {
+            run();
+         }
+         catch (WeldXmlException e)
+         {
+            if (e.getMessage().startsWith(errorCode))
+            {
+               return;
+            }
+         }
+         assert false;
+      }
+
+   }
+
+   private static void checkWithBeansXmlAndExpectException(String beansXml, WeldXmlException e)
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, Plain.class, IntBind.class);
+      List<URL> beansXmls = Arrays.asList(BeansXmlTest.class.getResource(beansXml));
+      new FailedDeployment(beans, beansXmls).runAndExpect(e);
+   }
+
+   // Multiple XML blocks
+
+   @Test
+   public void testMultipleAlternativeBlocksFail()
+   {
+      checkWithBeansXmlAndExpectException("multipleAlternativeBlocks.xml", new WeldXmlException(XmlMessage.MULTIPLE_ALTERNATIVES));
+   }
+
+   @Test
+   public void testMultipleDecoratorBlocksFail()
+   {
+      checkWithBeansXmlAndExpectException("multipleDecoratorBlocks.xml", new WeldXmlException(XmlMessage.MULTIPLE_DECORATORS));
+   }
+
+   @Test
+   public void testMultipleInterceptorBlocksFail()
+   {
+      checkWithBeansXmlAndExpectException("multipleInterceptorsBlocks.xml", new WeldXmlException(XmlMessage.MULTIPLE_INTERCEPTORS));
+   }
+
+   @Test
+   public void testAlternativesEnabled()
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
+      List<URL> beansXmls = Arrays.asList(getClass().getResource("alternative.xml"));
+      TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+      Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
+      container.stopContainer();
+   }
+
+   @Test
+   public void testDecoratorsEnabled()
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
+      List<URL> beansXmls = Arrays.asList(getClass().getResource("decorator.xml"));
+      TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getDecorators().size());
+      Assert.assertEquals(Dec.class, container.getBeanManager().getEnabledClasses().getDecorators().iterator().next());
+      container.stopContainer();
+   }
+
+   @Test
+   public void testInterceptorsEnabled()
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
+      List<URL> beansXmls = Arrays.asList(getClass().getResource("interceptor.xml"));
+      TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getInterceptors().size());
+      Assert.assertEquals(Int.class, container.getBeanManager().getEnabledClasses().getInterceptors().iterator().next());
+      container.stopContainer();
+   }
+
+   @Test
+   public void testMergeBeansXmls()
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
+      List<URL> beansXmls = Arrays.asList(getClass().getResource("alternative.xml"), getClass().getResource("decorator.xml"), getClass().getResource("interceptor.xml"));
+      TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+      Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getInterceptors().size());
+      Assert.assertEquals(Int.class, container.getBeanManager().getEnabledClasses().getInterceptors().iterator().next());
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getDecorators().size());
+      Assert.assertEquals(Dec.class, container.getBeanManager().getEnabledClasses().getDecorators().iterator().next());
+      container.stopContainer();
+   }
+
+   @Test
+   public void testBeansXmlDoesntExist()
+   {
+      checkWithBeansXmlAndExpectException("nope.xml", new WeldXmlException(XmlMessage.LOAD_ERROR));
+   }
+   
+   // WELD-467
+   @Test
+   public void testNamespacedBeansXml()
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
+      List<URL> beansXmls = Arrays.asList(getClass().getResource("namespaced.xml"));
+      TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+      Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
+      container.stopContainer();
+   }
+   
+   // WELD-467
+   @Test
+   public void testNotDefaultNamespacedBeansXml()
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
+      List<URL> beansXmls = Arrays.asList(getClass().getResource("nonDefaultNamespaced.xml"));
+      TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+      Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
+      container.stopContainer();
+   }
+
+   /*
+    * https://jira.jboss.org/jira/browse/WELD-362
+    */
+   @Test
+   public void testNonPrettyPrintedXML()
+   {
+      List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
+      List<URL> beansXmls = Arrays.asList(getClass().getResource("nonPrettyPrinted.xml"));
+      TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
+      Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+      Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
+      container.stopContainer();
+   }
+
+   @Test
+   public void testCannotLoadFile() throws MalformedURLException
+   {
+      List<Class<?>> beans = Collections.emptyList();
+      new FailedDeployment(beans, Arrays.asList(new URL("http://foo.bar/beans.xml"))).runAndExpect(new WeldXmlException(XmlMessage.LOAD_ERROR));
+   }
+
+   @Test
+   public void testParsingError()
+   {
+      checkWithBeansXmlAndExpectException("unparseable.xml", new WeldXmlException(XmlMessage.PARSING_ERROR));
+   }
+
+   @Test
+   public void testCannotLoadClass()
+   {
+      checkWithBeansXmlAndExpectException("unloadable.xml", new WeldXmlException(XmlMessage.CANNOT_LOAD_CLASS));
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Dec.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Dec.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Dec.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap.xml;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+ at Decorator
+public class Dec
+{
+   @Inject @Delegate Plain plain;
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Int.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Int.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Int.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap.xml;
+
+import javax.interceptor.Interceptor;
+
+ at Interceptor
+ at IntBind
+public class Int
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/IntBind.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/IntBind.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/IntBind.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap.xml;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import javax.interceptor.InterceptorBinding;
+
+ at InterceptorBinding
+ at Inherited
+ at Target( { TYPE, METHOD })
+ at Retention(RUNTIME)
+public @interface IntBind
+{
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Plain.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Plain.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/Plain.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.bootstrap.xml;
+
+public class Plain
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Fodder.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Fodder.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Fodder.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.cluster;
+
+import java.io.Serializable;
+
+public class Fodder implements Serializable
+{
+
+   private static final long serialVersionUID = 7526196594918652669L;
+   
+   private int amount;
+   
+   public int getAmount()
+   {
+      return amount;
+   }
+   
+   public void setAmount(int amount)
+   {
+      this.amount = amount;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.cluster;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+ at SessionScoped
+public class Foo implements Serializable
+{
+   
+   private String name;
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Horse.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Horse.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Horse.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.cluster;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+public class Horse implements Serializable
+{
+   
+   private String name;
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/NaiveClusterTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.cluster;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.mock.cluster.AbstractClusterTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class NaiveClusterTest extends AbstractClusterTest
+{
+   /*
+    * description = "A simple test to check session replication, doesn't carefully check if a bean ids are correct"
+    */
+   @Test
+   public void testSimpleSessionReplication() throws Exception
+   {
+      
+      TestContainer container1 = bootstrapContainer(1, Arrays.<Class<?>>asList(Foo.class));
+      BeanManagerImpl beanManager1 = container1.getBeanManager();
+      Bean<?> fooBean1 = beanManager1.resolve(beanManager1.getBeans(Foo.class));
+      
+      TestContainer container2 = bootstrapContainer(2, Arrays.<Class<?>>asList(Foo.class));
+      BeanManagerImpl beanManager2 = container2.getBeanManager();
+      Bean<?> fooBean2 = beanManager2.resolve(beanManager2.getBeans(Foo.class));
+      
+      use(1);
+      // Set a value into Foo1
+      Foo foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
+      foo1.setName("container 1");
+      
+      replicateSession(1, beanManager1, 2, beanManager2);
+      
+      use(2);
+      Foo foo2 = (Foo) beanManager2.getReference(fooBean2, Foo.class, beanManager2.createCreationalContext(fooBean2));
+      Assert.assertEquals("container 1", foo2.getName());
+      use(2);
+      container2.stopContainer();
+      use(1);
+      container1.stopContainer();
+   }
+   
+   @Test
+   public void testMultipleDependentObjectsSessionReplication() throws Exception
+   {
+      Collection<Class<?>> classes = Arrays.<Class<?>>asList(Stable.class, Horse.class, Fodder.class);
+      TestContainer container1 = bootstrapContainer(1, classes);
+      BeanManagerImpl beanManager1 = container1.getBeanManager();
+      Bean<?> stableBean1 = beanManager1.resolve(beanManager1.getBeans(Stable.class));
+      
+      TestContainer container2 = bootstrapContainer(2, classes);
+      BeanManagerImpl beanManager2 = container2.getBeanManager();
+      Bean<?> stableBean2 = beanManager2.resolve(beanManager2.getBeans(Stable.class));
+      
+      use(1);
+      // Set a value into Foo1
+      Stable stable1 = (Stable) beanManager1.getReference(stableBean1, Foo.class, beanManager1.createCreationalContext(stableBean1));
+      stable1.getFodder().setAmount(10);
+      stable1.getHorse().setName("George");
+      
+      replicateSession(1, beanManager1, 2, beanManager2);
+      
+      use(2);
+      
+      Stable stable2 = (Stable) beanManager2.getReference(stableBean2, Stable.class, beanManager2.createCreationalContext(stableBean2));
+      Assert.assertEquals(stable2.getFodder().getAmount(), stable1.getFodder().getAmount());
+      Assert.assertNull(stable2.getHorse().getName());
+      
+      use(1);
+      Assert.assertEquals(10, stable1.getFodder().getAmount());
+      Assert.assertEquals("George", stable1.getHorse().getName());
+      
+      use(2);
+      
+      stable2.getFodder().setAmount(11);
+      
+      replicateSession(2, beanManager2, 1, beanManager1);
+      
+      use(1);
+      
+      Assert.assertEquals(11, stable1.getFodder().getAmount());
+      use(1);
+      container1.stopContainer();
+      use(2);
+      container2.stopContainer();
+   }
+   
+   @Test
+   public void testVariableBeanDeploymentStructure() throws Exception
+   {
+      // NB This is not a valid deployment scenario for a cluster, but it does allow us to test bean ids neatly!
+      Collection<Class<?>> classes1 = Arrays.<Class<?>>asList(Stable.class, Horse.class, Fodder.class);
+      Collection<Class<?>> classes2 = Arrays.<Class<?>>asList(Stable.class, Horse.class, Fodder.class, Foo.class);
+      TestContainer container1 = bootstrapContainer(1, classes1);
+      BeanManagerImpl beanManager1 = container1.getBeanManager();
+      Bean<?> stableBean1 = beanManager1.resolve(beanManager1.getBeans(Stable.class));
+      
+      TestContainer container2 = bootstrapContainer(2, classes2);
+      BeanManagerImpl beanManager2 = container2.getBeanManager();
+      Bean<?> stableBean2 = beanManager2.resolve(beanManager2.getBeans(Stable.class));
+      
+      use(1);
+      // Set a value into Foo1
+      Stable stable1 = (Stable) beanManager1.getReference(stableBean1, Foo.class, beanManager1.createCreationalContext(stableBean1));
+      stable1.getFodder().setAmount(10);
+      stable1.getHorse().setName("George");
+      
+      replicateSession(1, beanManager1, 2, beanManager2);
+      
+      use(2);
+      
+      Stable stable2 = (Stable) beanManager2.getReference(stableBean2, Stable.class, beanManager2.createCreationalContext(stableBean2));
+      Assert.assertEquals(stable2.getFodder().getAmount(), stable1.getFodder().getAmount());
+      Assert.assertNull(stable2.getHorse().getName());
+      use(1);
+      container1.stopContainer();
+      use(2);
+      container2.stopContainer();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Stable.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Stable.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/Stable.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.cluster;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+ at SessionScoped
+public class Stable implements Serializable
+{
+   
+   /**
+    * 
+    */
+   private static final long serialVersionUID = 4007799511309218679L;
+
+   @Inject
+   private Horse horse;
+   
+   @Inject
+   private Fodder fodder;
+   
+   public Horse getHorse()
+   {
+      return horse;
+   }
+   
+   public Fodder getFodder()
+   {
+      return fodder;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/SwitchableContainerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/SwitchableContainerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/cluster/SwitchableContainerTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.cluster;
+
+import java.util.Arrays;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.bootstrap.api.SingletonProvider;
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.mock.cluster.AbstractClusterTest;
+import org.jboss.weld.mock.cluster.SwitchableSingletonProvider;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SwitchableContainerTest extends AbstractClusterTest
+{
+
+   @Test
+   public void test()
+   {
+      
+      // Bootstrap container 1
+      SwitchableSingletonProvider.use(1);
+      
+      TestContainer container1 = new TestContainer(new MockEELifecycle(), Arrays.<Class<?>>asList(Foo.class), null);
+      container1.startContainer();
+      container1.ensureRequestActive();
+      
+      BeanManager beanManager1 = container1.getBeanManager();
+      Bean<?> fooBean1 = beanManager1.resolve(beanManager1.getBeans(Foo.class));
+      Foo foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
+      foo1.setName("container 1");
+      
+      // Bootstrap container 2
+      SwitchableSingletonProvider.use(2);
+      
+      TestContainer container2 = new TestContainer(new MockEELifecycle(), Arrays.<Class<?>>asList(Foo.class), null);
+      container2.startContainer();
+      container2.ensureRequestActive();
+      
+      BeanManager beanManager2 = container2.getBeanManager();
+      Bean<?> fooBean2 = beanManager2.resolve(beanManager2.getBeans(Foo.class));
+      Foo foo2 = (Foo) beanManager2.getReference(fooBean2, Foo.class, beanManager2.createCreationalContext(fooBean2));
+      foo2.setName("container 2");
+      
+      // Switch to container 1 and check value
+      SwitchableSingletonProvider.use(1);
+      foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
+      Assert.assertEquals("container 1", foo1.getName());
+      
+      // Switch to container 2 and check value
+      SwitchableSingletonProvider.use(2);
+      foo2 = (Foo) beanManager2.getReference(fooBean2, Foo.class, beanManager2.createCreationalContext(fooBean2));
+      Assert.assertEquals("container 2", foo2.getName());
+      SingletonProvider.reset();
+      container1.stopContainer();
+      container2.stopContainer();
+      SingletonProvider.reset();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+public class Bar
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver1.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver1.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver1.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+
+public class CountingObserver1 implements Extension
+{
+   
+   private int beforeBeanDiscovery;
+   private int processFooManagedBean;
+   private int processBarManagedBean;
+
+   public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
+   {
+      beforeBeanDiscovery++;
+   }
+   
+   public void observerProcessFooManagedBean(@Observes ProcessManagedBean<Foo> event)
+   {
+      processFooManagedBean++;
+   }
+   
+   public void observerProcessBarManagedBean(@Observes ProcessManagedBean<Bar> event)
+   {
+      processBarManagedBean++;
+   }
+   
+   public int getBeforeBeanDiscovery()
+   {
+      return beforeBeanDiscovery;
+   }
+   
+   public int getProcessFooManagedBean()
+   {
+      return processFooManagedBean;
+   }
+   
+   public int getProcessBarManagedBean()
+   {
+      return processBarManagedBean;
+   }
+     
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver2.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver2.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/CountingObserver2.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+
+public class CountingObserver2 implements Extension
+{
+   
+   private int beforeBeanDiscovery;
+   private int processFooManagedBean;
+   private int processBarManagedBean;
+
+   public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager)
+   {
+      beforeBeanDiscovery++;
+      event.addAnnotatedType(beanManager.createAnnotatedType(Bar.class));
+   }
+   
+   public void observerProcessFooManagedBean(@Observes ProcessManagedBean<Foo> event)
+   {
+      processFooManagedBean++;
+   }
+   
+   public void observerProcessBarManagedBean(@Observes ProcessManagedBean<Bar> event)
+   {
+      processBarManagedBean++;
+   }
+   
+   public int getBeforeBeanDiscovery()
+   {
+      return beforeBeanDiscovery;
+   }
+   
+   public int getProcessFooManagedBean()
+   {
+      return processFooManagedBean;
+   }
+   
+   public int getProcessBarManagedBean()
+   {
+      return processBarManagedBean;
+   }
+     
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+import javax.enterprise.inject.Produces;
+
+public class Foo
+{
+
+   @Produces
+   public String get()
+   {
+      return "Foo!";
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,164 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.AbstractMockDeployment;
+import org.jboss.weld.mock.MockBeanDeploymentArchive;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
+import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class NonBdaExtensionTest
+{
+   /*
+    * description = "WELD-233"
+    */
+   @Test
+   public void test()
+   {
+      // Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
+      final MockBeanDeploymentArchive bda1 = new MockBeanDeploymentArchive("1", Observer1.class, Foo.class);
+      
+      // Create the BDA to return from loadBeanDeploymentArchive for Observer2, this is probably a library, though could be another war or ejb jar
+      // bda2 is accessible from bda1, but isn't added to it's accessibility graph by default. This similar to an archive which doesn't contain a beans.xml but does contain an extension 
+      final BeanDeploymentArchive bda2 = new MockBeanDeploymentArchive("2", Observer2.class);
+      
+      // Create a deployment, that we can use to mirror the structure of one Extension inside a BDA, and one outside
+      Deployment deployment = new AbstractMockDeployment(bda1)
+      {
+         
+         public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+         {
+            // Return bda2 if it is Observer2. Stick anything else which this test isn't about in bda1
+            if (beanClass.equals(Observer2.class))
+            {
+               // If Observer2 is requested, then we need to add bda2 to the accessibility graph of bda1
+               bda1.getBeanDeploymentArchives().add(bda2);
+               return bda2;
+            }
+            else
+            {
+               return bda1;
+            }
+         }
+
+      };
+      
+      TestContainer container = new TestContainer(new MockServletLifecycle(deployment, bda1));
+      container.getLifecycle().initialize();
+      
+      // Add custom ServiceLoader so that we can load Extension services from current package, not META-INF/services
+      // We do this after startContainer() so we replace the default impl
+      deployment.getServices().add(ServiceLoaderFactory.class, new PackageServiceLoaderFactory(NonBdaExtensionTest.class.getPackage(), Extension.class));
+      
+      // Cause the container to deploy the beans etc.
+      container.getLifecycle().beginApplication();
+      
+      // Get the bean manager for bda1 and bda2
+      BeanManagerImpl beanManager1 = container.getBeanManager();
+      BeanManagerImpl beanManager2 = container.getLifecycle().getBootstrap().getManager(bda2);
+      
+      Observer1 observer1 = Utils.getReference(beanManager1, Observer1.class);
+      Assert.assertTrue(observer1.isBeforeBeanDiscoveryCalled());
+      Assert.assertEquals(beanManager1, observer1.getBeforeBeanDiscoveryBeanManager());
+      Assert.assertTrue(observer1.isAfterBeanDiscoveryCalled());
+      Assert.assertTrue(observer1.isAfterDeploymentValidationCalled());
+      Assert.assertTrue(observer1.isProcessInjectionTargetCalled());
+      Assert.assertTrue(observer1.isProcessManagedBeanCalled());
+      Assert.assertTrue(observer1.isProcessProducerCalled());
+      
+      Assert.assertEquals(1, beanManager2.getBeans(Observer2.class).size());
+      // Also check that the accessibility graph has been updated
+      Assert.assertEquals(1, beanManager1.getBeans(Observer2.class).size());
+      
+      Observer2 observer2 = Utils.getReference(beanManager2, Observer2.class);
+      Assert.assertTrue(observer2.isBeforeBeanDiscoveryCalled());
+      Assert.assertEquals(beanManager2, observer2.getBeforeBeanDiscoveryBeanManager());
+      Assert.assertTrue(observer2.isAfterBeanDiscoveryCalled());
+      Assert.assertTrue(observer2.isAfterDeploymentValidationCalled());
+      Assert.assertTrue(observer2.isProcessInjectionTargetCalled());
+      Assert.assertTrue(observer2.isProcessManagedBeanCalled());
+      Assert.assertTrue(observer2.isProcessProducerCalled());
+   }
+   
+   /*
+    * description = "WELD-258"
+    */
+   @Test
+   public void testEventsSentOnceOnly()
+   {
+   // Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
+      final MockBeanDeploymentArchive bda1 = new MockBeanDeploymentArchive("1", CountingObserver1.class, Foo.class);
+      
+      // Create the BDA to return from loadBeanDeploymentArchive for Observer2, this is probably a library, though could be another war or ejb jar
+      // bda2 is accessible from bda1, but isn't added to it's accessibility graph by default. This similar to an archive which doesn't contain a beans.xml but does contain an extension 
+      final BeanDeploymentArchive bda2 = new MockBeanDeploymentArchive("2", CountingObserver2.class);
+      
+      // Create a deployment, that we can use to mirror the structure of one Extension inside a BDA, and one outside
+      Deployment deployment = new AbstractMockDeployment(bda1)
+      {
+         
+         public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+         {
+            // Return bda2 if it is Observer2. Stick anything else which this test isn't about in bda1
+            if (beanClass.equals(CountingObserver2.class) || beanClass.equals(Bar.class))
+            {
+               // If Observer2 is requested, then we need to add bda2 to the accessibility graph of bda1
+               bda1.getBeanDeploymentArchives().add(bda2);
+               return bda2;
+            }
+            else
+            {
+               return bda1;
+            }
+         }
+
+      };
+      
+      TestContainer container = new TestContainer(new MockServletLifecycle(deployment, bda1));
+      container.getLifecycle().initialize();
+      
+      // Add custom ServiceLoader so that we can load Extension services from current package, not META-INF/services
+      // We do this after startContainer() so we replace the default impl
+      deployment.getServices().add(ServiceLoaderFactory.class, new PackageServiceLoaderFactory(NonBdaExtensionTest.class.getPackage(), Extension.class));
+      
+      // Cause the container to deploy the beans etc.
+      container.getLifecycle().beginApplication();
+      
+      // Get the bean manager for bda1 and bda2
+      BeanManagerImpl beanManager1 = container.getBeanManager();
+      
+      CountingObserver1 observer1 = Utils.getReference(beanManager1, CountingObserver1.class);
+      CountingObserver2 observer2 = Utils.getReference(beanManager1, CountingObserver2.class);
+      Assert.assertEquals(1, observer1.getBeforeBeanDiscovery());
+      Assert.assertEquals(1, observer1.getProcessFooManagedBean());
+      Assert.assertEquals(0, observer1.getProcessBarManagedBean());
+      Assert.assertEquals(1, observer2.getBeforeBeanDiscovery());
+      Assert.assertEquals(1, observer2.getProcessFooManagedBean());
+      Assert.assertEquals(1, observer2.getProcessBarManagedBean());
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer1.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer1.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer1.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessProducer;
+
+public class Observer1 extends ObserverBase implements Extension
+{
+   
+   public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
+   {
+      this.afterBeanDiscoveryCalled = true;
+   }
+   
+   public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager)
+   {
+      this.beforeBeanDiscoveryCalled = true;
+      this.beforeBeanDiscoveryBeanManager = beanManager;
+   }
+   
+   public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
+   {
+      afterDeploymentValidationCalled = true;
+   }
+   
+   public void observeProcessProducer(@Observes ProcessProducer<Foo, String> event)
+   {
+      processProducerCalled = true;
+   }
+   
+   public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<Foo> event)
+   {
+      processInjectionTargetCalled = true;
+   }
+   
+   public void observeProcessManagedBean(@Observes ProcessManagedBean<Foo> event)
+   {
+      processManagedBeanCalled = true;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer2.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer2.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/Observer2.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessProducer;
+
+public class Observer2 extends ObserverBase implements Extension
+{
+   
+   public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
+   {
+      this.afterBeanDiscoveryCalled = true;
+   }
+   
+   public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager)
+   {
+      this.beforeBeanDiscoveryCalled = true;
+      this.beforeBeanDiscoveryBeanManager = beanManager;
+   }
+   
+   public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
+   {
+      afterDeploymentValidationCalled = true;
+   }
+   
+   public void observeProcessProducer(@Observes ProcessProducer<Foo, String> event)
+   {
+      processProducerCalled = true;
+   }
+   
+   public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<Foo> event)
+   {
+      processInjectionTargetCalled = true;
+   }
+   
+   public void observeProcessManagedBean(@Observes ProcessManagedBean<Foo> event)
+   {
+      processManagedBeanCalled = true;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/ObserverBase.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/ObserverBase.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/ObserverBase.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.extensions;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+public class ObserverBase
+{
+
+   protected boolean afterBeanDiscoveryCalled;
+   protected boolean beforeBeanDiscoveryCalled;
+   protected boolean afterDeploymentValidationCalled;
+   protected boolean processProducerCalled;
+   protected boolean processInjectionTargetCalled;
+   protected boolean processManagedBeanCalled;
+   
+   protected BeanManager beforeBeanDiscoveryBeanManager;
+
+   public ObserverBase()
+   {
+      super();
+   }
+
+   public boolean isAfterBeanDiscoveryCalled()
+   {
+      return afterBeanDiscoveryCalled;
+   }
+
+   public boolean isBeforeBeanDiscoveryCalled()
+   {
+      return beforeBeanDiscoveryCalled;
+   }
+
+   public boolean isAfterDeploymentValidationCalled()
+   {
+      return afterDeploymentValidationCalled;
+   }
+
+   public boolean isProcessProducerCalled()
+   {
+      return processProducerCalled;
+   }
+
+   public boolean isProcessInjectionTargetCalled()
+   {
+      return processInjectionTargetCalled;
+   }
+
+   public boolean isProcessManagedBeanCalled()
+   {
+      return processManagedBeanCalled;
+   }
+   
+   public BeanManager getBeforeBeanDiscoveryBeanManager()
+   {
+      return beforeBeanDiscoveryBeanManager;
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Alt.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Alt.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Alt.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.nonTransitiveResolution;
+
+import javax.enterprise.inject.Alternative;
+
+ at Alternative
+public class Alt
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Bar.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Bar.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Bar.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.nonTransitiveResolution;
+
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+public class Bar
+{
+   
+   @Inject private Foo foo;
+   
+   // Inject the bean manager to make sure the bean is intranstive
+   @Inject private BeanManager beanManager;
+   
+   // Inject the @New bean to make sure the bean is intranstive   
+   @Inject @New String str;
+   
+   public Foo getFoo()
+   {
+      return foo;
+   }
+   
+   public BeanManager getBeanManager()
+   {
+      return beanManager;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/Foo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.nonTransitiveResolution;
+
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+public class Foo
+{
+   
+   // Inject the bean manager to make sure the bean is intranstive  
+   @Inject private BeanManager beanManager;
+   
+   // Inject the @New bean to make sure the bean is intranstive
+   @Inject @New String str;
+   
+   public BeanManager getBeanManager()
+   {
+      return beanManager;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.nonTransitiveResolution;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.AbstractMockDeployment;
+import org.jboss.weld.mock.MockBeanDeploymentArchive;
+import org.jboss.weld.mock.MockDeployment;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TransitiveResolutionTest
+{
+   /*
+    * description = "WELD-319"
+    */
+   @Test
+   public void testBeansXmlIsolation()
+   {
+      MockBeanDeploymentArchive jar1 = new MockBeanDeploymentArchive("first-jar", Alt.class);
+      MockBeanDeploymentArchive jar2 = new MockBeanDeploymentArchive("second-jar", Alt.class);
+      jar1.getBeansXml().add(getClass().getResource("beans.xml"));
+      MockBeanDeploymentArchive war = new MockBeanDeploymentArchive("war");
+      war.getBeanDeploymentArchives().add(jar1);
+      war.getBeanDeploymentArchives().add(jar2);
+      
+      Deployment deployment = new MockDeployment(war);
+      
+      TestContainer container = null;
+      try
+      {
+         container = new TestContainer(new MockServletLifecycle(deployment, war)).startContainer().ensureRequestActive();
+         BeanManagerImpl warBeanManager = container.getBeanManager();
+         BeanManagerImpl jar1BeanManager = container.getLifecycle().getBootstrap().getManager(jar1);         
+         BeanManagerImpl jar2BeanManager = container.getLifecycle().getBootstrap().getManager(jar2);
+         Assert.assertTrue(warBeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+         Assert.assertFalse(jar1BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+         Assert.assertTrue(jar2BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+      }
+      finally
+      {
+         if (container != null)
+         {
+            container.stopContainer();
+         }
+      }
+   }
+   
+   /*
+    * description = "WELD-319"
+    */
+   @Test
+   public void testBeansXmlMultipleEnabling()
+   {
+      MockBeanDeploymentArchive jar1 = new MockBeanDeploymentArchive("first-jar", Alt.class);
+      MockBeanDeploymentArchive jar2 = new MockBeanDeploymentArchive("second-jar", Alt.class);
+      jar1.getBeansXml().add(getClass().getResource("beans.xml"));
+      jar2.getBeansXml().add(getClass().getResource("beans.xml"));
+      MockBeanDeploymentArchive war = new MockBeanDeploymentArchive("war");
+      war.getBeanDeploymentArchives().add(jar1);
+      war.getBeanDeploymentArchives().add(jar2);
+      
+      Deployment deployment = new MockDeployment(war);
+      
+      TestContainer container = null;
+      try
+      {
+         container = new TestContainer(new MockServletLifecycle(deployment, war)).startContainer().ensureRequestActive();
+         BeanManagerImpl warBeanManager = container.getBeanManager();
+         BeanManagerImpl jar1BeanManager = container.getLifecycle().getBootstrap().getManager(jar1);         
+         BeanManagerImpl jar2BeanManager = container.getLifecycle().getBootstrap().getManager(jar2);
+         Assert.assertTrue(warBeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+         Assert.assertFalse(jar1BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+         Assert.assertFalse(jar2BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+      }
+      finally
+      {
+         if (container != null)
+         {
+            container.stopContainer();
+         }
+      }
+   }   
+
+   /*
+    * description = "WELD-236"
+    */
+   @Test
+   public void testTypicalEarStructure()
+   {
+
+      // Create the BDA in which we will deploy Foo. This is equivalent to a ejb
+      // jar
+      final MockBeanDeploymentArchive ejbJar = new MockBeanDeploymentArchive("ejb-jar", Foo.class);
+
+      // Create the BDA in which we will deploy Bar. This is equivalent to a war
+      MockBeanDeploymentArchive war = new MockBeanDeploymentArchive("war", Bar.class);
+
+      // The war can access the ejb jar
+      war.getBeanDeploymentArchives().add(ejbJar);
+
+      // Create a deployment, any other classes are put into the ejb-jar (not
+      // relevant to test)
+      Deployment deployment = new AbstractMockDeployment(war, ejbJar)
+      {
+
+         public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+         {
+            return ejbJar;
+         }
+
+      };
+
+      TestContainer container = new TestContainer(new MockServletLifecycle(deployment, war));
+      container.startContainer();
+      container.ensureRequestActive();
+
+      // Get the bean manager for war and ejb jar
+      BeanManagerImpl warBeanManager = container.getBeanManager();
+      BeanManagerImpl ejbJarBeanManager = container.getLifecycle().getBootstrap().getManager(ejbJar);
+
+      Assert.assertEquals(1, warBeanManager.getBeans(Bar.class).size());
+      Assert.assertEquals(1, warBeanManager.getBeans(Foo.class).size());
+      Assert.assertEquals(1, ejbJarBeanManager.getBeans(Foo.class).size());
+      Assert.assertEquals(0, ejbJarBeanManager.getBeans(Bar.class).size());
+      Bar bar = Utils.getReference(warBeanManager, Bar.class);
+      Assert.assertNotNull(bar.getFoo());
+      Assert.assertNotNull(bar.getBeanManager());
+      Assert.assertEquals(warBeanManager, bar.getBeanManager());
+      Assert.assertEquals(ejbJarBeanManager, bar.getFoo().getBeanManager());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.resolution;
+
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.bean.interceptor.InterceptionMetadataService;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.ejb.EjbDescriptors;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.manager.EnabledClasses;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.serialization.ContextualStoreImpl;
+import org.jboss.weld.serialization.spi.ContextualStore;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AccessibleManagerResolutionTest
+{
+   
+   private ClassTransformer classTransformer;
+   private ServiceRegistry services;
+   
+   @Before
+   public void beforeMethod()
+   {
+      this.classTransformer = new ClassTransformer(new TypeStore());
+      this.services = new SimpleServiceRegistry();
+      this.services.add(MetaAnnotationStore.class, new MetaAnnotationStore(classTransformer));
+      this.services.add(ContextualStore.class, new ContextualStoreImpl());
+      this.services.add(InterceptionMetadataService.class, new InterceptionMetadataService());
+      this.services.add(ClassTransformer.class, classTransformer);
+   }
+   
+   private void addBean(BeanManagerImpl manager, Class<?> c)
+   {
+      WeldClass<?> clazz = WeldClassImpl.of(c, classTransformer);
+      RIBean<?> bean = ManagedBean.of(clazz, manager);
+      manager.addBean(bean);
+      BeanDeployerEnvironment environment = new BeanDeployerEnvironment(new EjbDescriptors(), manager);
+      bean.initialize(environment);
+   }
+   
+   @Test
+   public void testAccessibleDynamicallySingleLevel()
+   {
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
+      Container.initialize(root, services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
+      addBean(root, Cow.class);
+      Assert.assertEquals(1, root.getBeans(Cow.class).size());
+      Assert.assertEquals(0, child.getBeans(Cow.class).size());
+      child.addAccessibleBeanManager(root);
+      Set<Bean<?>> beans = child.getBeans(Cow.class);
+      Assert.assertEquals(1, child.getBeans(Cow.class).size());
+      addBean(child, Chicken.class);
+      Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+      Assert.assertEquals(0, root.getBeans(Chicken.class).size());
+   }
+   
+   @Test
+   public void testAccessibleThreeLevelsWithMultiple()
+   {
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
+      Container.initialize(root, services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
+      BeanManagerImpl child1 = BeanManagerImpl.newRootManager("child1", services, new EnabledClasses());
+      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services, new EnabledClasses());
+      BeanManagerImpl greatGrandchild = BeanManagerImpl.newRootManager("greatGrandchild", services, new EnabledClasses());
+      child.addAccessibleBeanManager(root);
+      grandchild.addAccessibleBeanManager(child1);
+      grandchild.addAccessibleBeanManager(child);
+      addBean(greatGrandchild, Cat.class);
+      greatGrandchild.addAccessibleBeanManager(grandchild);
+      addBean(root, Cow.class);
+      addBean(child, Chicken.class);
+      addBean(grandchild, Pig.class);
+      addBean(child1, Horse.class);
+      Assert.assertEquals(0, root.getBeans(Pig.class).size());
+      Assert.assertEquals(0, root.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, root.getBeans(Cow.class).size());
+      Assert.assertEquals(0, root.getBeans(Horse.class).size());
+      Assert.assertEquals(0, root.getBeans(Cat.class).size());
+      Assert.assertEquals(0, child.getBeans(Pig.class).size());
+      Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, child.getBeans(Cow.class).size());
+      Assert.assertEquals(0, child.getBeans(Horse.class).size());
+      Assert.assertEquals(0, child.getBeans(Cat.class).size());
+      Assert.assertEquals(0, child1.getBeans(Cow.class).size());
+      Assert.assertEquals(1, child1.getBeans(Horse.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Pig.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Cow.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Horse.class).size());
+      Assert.assertEquals(0, grandchild.getBeans(Cat.class).size());
+      Assert.assertEquals(1, greatGrandchild.getBeans(Pig.class).size());
+      Assert.assertEquals(1, greatGrandchild.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, greatGrandchild.getBeans(Cow.class).size());
+      Assert.assertEquals(1, greatGrandchild.getBeans(Horse.class).size());
+      Assert.assertEquals(1, greatGrandchild.getBeans(Cat.class).size());
+   }
+   
+   @Test
+   public void testSameManagerAddedTwice()
+   {
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
+      Container.initialize(root, services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
+      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services, new EnabledClasses());
+      grandchild.addAccessibleBeanManager(child);
+      child.addAccessibleBeanManager(root);
+      grandchild.addAccessibleBeanManager(root);
+      addBean(root, Cow.class);
+      addBean(child, Chicken.class);
+      addBean(grandchild, Pig.class);
+      Assert.assertEquals(0, root.getBeans(Pig.class).size());
+      Assert.assertEquals(0, root.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, root.getBeans(Cow.class).size());
+      Assert.assertEquals(0, child.getBeans(Pig.class).size());
+      Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, child.getBeans(Cow.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Pig.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Cow.class).size());
+   }
+   
+   @Test
+   public void testCircular()
+   {
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
+      Container.initialize(root, services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
+      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services, new EnabledClasses());
+      grandchild.addAccessibleBeanManager(child);
+      child.addAccessibleBeanManager(root);
+      grandchild.addAccessibleBeanManager(root);
+      root.addAccessibleBeanManager(grandchild);
+      addBean(root, Cow.class);
+      addBean(child, Chicken.class);
+      addBean(grandchild, Pig.class);
+      Assert.assertEquals(1, root.getBeans(Pig.class).size());
+      Assert.assertEquals(1, root.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, root.getBeans(Cow.class).size());
+      Assert.assertEquals(1, child.getBeans(Pig.class).size());
+      Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, child.getBeans(Cow.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Pig.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Chicken.class).size());
+      Assert.assertEquals(1, grandchild.getBeans(Cow.class).size());
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cat.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cat.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cat.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.resolution;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Cat
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Chicken.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Chicken.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Chicken.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.resolution;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Chicken
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cow.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cow.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Cow.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.resolution;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Cow
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Horse.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Horse.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Horse.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.resolution;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Horse
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Pig.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Pig.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/Pig.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.deployment.structure.resolution;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Pig
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Animal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Animal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Animal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+interface Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlyAnimal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlyAnimal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlyAnimal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+interface DeadlyAnimal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlySpider.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlySpider.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DeadlySpider.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+interface DeadlySpider extends DeadlyAnimal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DefangedTarantula.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DefangedTarantula.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/DefangedTarantula.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+class DefangedTarantula extends Tarantula
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Hound.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Hound.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Hound.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Named;
+
+ at Stateful
+ at Tame
+ at Named("Pongo")
+class Hound implements HoundLocal
+{ 
+   @Remove
+   public void bye() {
+   }
+
+   public void ping()
+   {
+      
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/HoundLocal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/HoundLocal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/HoundLocal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import javax.ejb.Local;
+
+ at Local
+public interface HoundLocal
+{
+   
+   public void ping();
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Salmon.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Salmon.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Salmon.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import javax.inject.Named;
+
+ at Named
+class Salmon implements ScottishFish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ScottishFish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ScottishFish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ScottishFish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+interface ScottishFish extends Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/SeaBass.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/SeaBass.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/SeaBass.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class SeaBass implements Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.bean.RIBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.test.Utils;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ServletEnvironmentTest
+{
+   
+   private static TestContainer container;
+   private static BeanManagerImpl manager;
+   
+   @BeforeClass
+   public static void beforeClass() throws Throwable
+   {
+      container = new TestContainer(new MockServletLifecycle(), Arrays.asList(Animal.class, DeadlyAnimal.class, DeadlySpider.class, DeadlyAnimal.class, Hound.class, HoundLocal.class, Salmon.class, ScottishFish.class, SeaBass.class, Sole.class, Spider.class, Tarantula.class, TarantulaProducer.class, Tuna.class), null);
+      container.startContainer();
+      container.ensureRequestActive();
+      manager = container.getBeanManager();
+   }
+   
+   @AfterClass
+   public static void afterClass() throws Exception
+   {
+      container.stopContainer();
+      container = null;
+      manager = null;
+   }
+   
+   @Test
+   public void testSimpleBeans()
+   {
+      Map<Class<?>, Bean<?>> beans = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : manager.getBeans())
+      {
+         if (bean instanceof RIBean<?>)
+         {
+            beans.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(beans.containsKey(Tuna.class));
+      Assert.assertTrue(beans.containsKey(Salmon.class));
+      Assert.assertTrue(beans.containsKey(SeaBass.class));
+      Assert.assertTrue(beans.containsKey(Sole.class));
+      
+      Assert.assertTrue(beans.get(Tuna.class) instanceof ManagedBean<?>);
+      Assert.assertTrue(beans.get(Salmon.class) instanceof ManagedBean<?>);
+      Assert.assertTrue(beans.get(SeaBass.class) instanceof ManagedBean<?>);
+      Assert.assertTrue(beans.get(Sole.class) instanceof ManagedBean<?>);
+      Utils.getReference(manager, Sole.class, new AnnotationLiteral<Whitefish>() {}).ping();
+   }
+   
+   @Test
+   public void testProducerMethodBean()
+   {
+      Map<Class<?>, Bean<?>> beans = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : manager.getBeans())
+      {
+         if (bean instanceof RIBean<?>)
+         {
+            beans.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(beans.containsKey(TarantulaProducer.class));
+      Assert.assertTrue(beans.containsKey(Tarantula.class));
+      
+      beans.get(TarantulaProducer.class);
+      
+      Assert.assertTrue(beans.get(TarantulaProducer.class) instanceof ManagedBean<?>);
+      Utils.getReference(manager, Tarantula.class, new AnnotationLiteral<Tame>() {}).ping();
+   }
+   
+   public void testSingleEnterpriseBean()
+   {
+      List<Bean<?>> beans = manager.getBeans();
+      Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof RIBean<?>)
+         {
+            classes.put(((RIBean<?>) bean).getType(), bean);
+         }
+      }
+      Assert.assertTrue(classes.containsKey(Hound.class));
+      Assert.assertTrue(classes.get(Hound.class) instanceof ManagedBean<?>);
+      Utils.getReference(manager, HoundLocal.class, new AnnotationLiteral<Tame>() {}).ping();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.resolution.wbri293.ContextualReferenceTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * A set of tests that validates that the contexts are properly created and
+ * destroyed from the perspective of a servlet environment.
+ * 
+ * TODO PLM this test is severely broken in design due to a lack of
+ * understanding of how lifecycle is built (it is an application singleton, it
+ * can't just be replaced). If it starts to fail, it needs rewriting to be an
+ * i/c test that runs in a servlet container OR without using the deployment
+ * arch
+ * 
+ * TODO Rewrite correctly
+ * 
+ * @author Dan Allen
+ */
+ at RunWith(Arquillian.class)
+public class ServletLifecycleTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create(BeanArchive.class);
+   }
+
+   @Test
+   public void testEndSessionWithActiveRequestAndSessionContexts()
+   {
+//      ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
+//      BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
+//      RequestContext.instance().setBeanStore(requestBeanStore);
+//      RequestContext.instance().setActive(true);
+//
+//      BeanStore sessionBeanStore = new ConcurrentHashMapBeanStore();
+//      SessionContext.instance().setBeanStore(sessionBeanStore);
+//      SessionContext.instance().setActive(true);
+//
+//      HttpSession session = new MockHttpSession("99");
+//      servletLifecycle.endSession(session);
+//      assert Boolean.FALSE.equals(SessionContext.instance().isActive()) : "Session context should no longer be active";
+//      assert Boolean.TRUE.equals(RequestContext.instance().isActive()) : "Request context should still be active";
+   }
+
+   @Test
+   @Category(Broken.class)
+   public void testEndSessionWithActiveRequestContextOnly()
+   {
+//      ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
+//      BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
+//      RequestContext.instance().setBeanStore(requestBeanStore);
+//      RequestContext.instance().setActive(true);
+//
+//      HttpSession session = new MockHttpSession("99");
+//      servletLifecycle.endSession(session);
+//      assert Boolean.FALSE.equals(SessionContext.instance().isActive()) : "Session context should no longer be active";
+//      assert Boolean.TRUE.equals(RequestContext.instance().isActive()) : "Request context should still be active";
+   }
+
+   @Test
+   @Category(Broken.class)
+   public void testEndSessionWithNoActiveRequestOrSessionContexts()
+   {
+//      ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
+//
+//      HttpSession session = new MockHttpSession("99");
+//      servletLifecycle.endSession(session);
+//      assert Boolean.FALSE.equals(SessionContext.instance().isActive()) : "Session context should no longer be active";
+//      assert Boolean.FALSE.equals(RequestContext.instance().isActive()) : "Temporary request context should have been deactivated";
+   }
+
+   @Before
+   @Category(Broken.class)
+   public void beforeMethod()
+   {
+//      RequestContext.instance().setBeanStore(null);
+//      RequestContext.instance().setActive(false);
+//      SessionContext.instance().setBeanStore(null);
+//      SessionContext.instance().setActive(false);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Sole.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Sole.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Sole.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import javax.ejb.EJB;
+import javax.inject.Named;
+
+ at Whitefish
+ at Named("whitefish")
+class Sole implements ScottishFish
+{
+   
+   @EJB HoundLocal hound;
+   
+   public void ping()
+   {
+      
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Spider.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Spider.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Spider.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+class Spider implements Animal
+{
+
+   public final void layEggs()
+   {
+      
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tame.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Tame
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tarantula.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tarantula.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tarantula.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+class Tarantula extends Spider implements DeadlySpider
+{
+
+   public void ping()
+   {
+      
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/TarantulaProducer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/TarantulaProducer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/TarantulaProducer.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import javax.enterprise.inject.Produces;
+
+public class TarantulaProducer
+{
+   
+   @Produces @Tame public Tarantula produceTameTarantula()
+   {
+      return new DefangedTarantula();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tuna.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tuna.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Tuna.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+import javax.enterprise.context.RequestScoped;
+
+ at RequestScoped
+class Tuna
+{
+   
+   public String getName()
+   {
+      return "Ophir";
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Whitefish.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Whitefish.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/Whitefish.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.environments.servlet;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Whitefish
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.jsf;
+
+import javax.faces.component.behavior.Behavior;
+import javax.faces.context.FacesContext;
+
+import org.jboss.weld.jsf.JsfApiAbstraction;
+import org.jboss.weld.resources.DefaultResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoadingException;
+import org.jboss.weld.util.ApiAbstraction.Dummy;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Dan Allen
+ */
+public class JsfApiAbstractionTest
+{
+   
+   @Test
+   public void testDetectsJsf12Version()
+   {
+      JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoaderHidingJsf20Classes());
+      Assert.assertEquals(1.2, abstraction.MINIMUM_API_VERSION, 0);
+      Assert.assertFalse(abstraction.isApiVersionCompatibleWith(2.0));
+   }
+
+   @Test
+   public void testLoadsJsf12Classes()
+   {
+      JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoaderHidingJsf20Classes());
+      Assert.assertEquals(FacesContext.class, abstraction.FACES_CONTEXT);
+      Assert.assertEquals(Dummy.class, abstraction.BEHAVIOR_CLASS);
+   }
+
+   @Test
+   public void testDetectsJsf20Version()
+   {
+      JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoader());
+      Assert.assertEquals(2.0, abstraction.MINIMUM_API_VERSION, 0);
+      Assert.assertTrue(abstraction.isApiVersionCompatibleWith(2.0));
+   }
+
+   @Test
+   public void testLoadsJsf20Classes()
+   {
+      JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoader());
+      Assert.assertEquals(FacesContext.class, abstraction.FACES_CONTEXT);
+      Assert.assertEquals(Behavior.class, abstraction.BEHAVIOR_CLASS);
+   }
+
+   private ResourceLoader getResourceLoader()
+   {
+      return new DefaultResourceLoader();
+   }
+
+   private ResourceLoader getResourceLoaderHidingJsf20Classes()
+   {
+      return new DefaultResourceLoader()
+      {
+
+         @Override
+         public Class<?> classForName(String name)
+         {
+            if ("javax.faces.component.behavior.Behavior".equals(name))
+            {
+               throw new ResourceLoadingException("Hidden class");
+            }
+            return super.classForName(name);
+         }
+
+      };
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.annotation;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Method;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+ at Synchronous
+public class AnnotationTest
+{
+   
+   @Test
+   public void testSerializability() throws Throwable
+   {
+      Synchronous synchronous = AnnotationTest.class.getAnnotation(Synchronous.class);
+      deserialize(serialize(synchronous));
+   }
+   
+   @Test
+   public void testGetAnnotationDefaults() throws Throwable
+   {
+      Method method = Quality.class.getMethod("value");
+      Object value = method.getDefaultValue();
+      Assert.assertEquals("very", value);
+   }
+
+   protected byte[] serialize(Object instance) throws IOException
+   {
+      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+      ObjectOutputStream out = new ObjectOutputStream(bytes);
+      out.writeObject(instance);
+      return bytes.toByteArray();
+   }
+
+   protected <T> T deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+   {
+      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
+      return (T) in.readObject();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Quality.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Quality.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Quality.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.annotation;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Quality
+{
+   
+   String value() default "very";
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/Synchronous.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.annotation;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+ at interface Synchronous
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Animal.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Animal.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Animal.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+interface Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Antelope.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Antelope.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Antelope.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+
+class Antelope implements Animal
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Kangaroo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Kangaroo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Kangaroo.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+
+public class Kangaroo 
+{
+   LittleKangarooInHerPouch<String> procreate()
+   {
+      return new LittleKangarooInHerPouch<String>("Joey");
+   }
+
+   public class LittleKangarooInHerPouch<T>
+   {
+      LittleKangarooInHerPouch(T formalParam)
+      {
+      }
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Koala.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Koala.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Koala.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+public class Koala
+{
+   
+   public Animal procreate()
+   {
+      class BabyKoala implements Animal {}
+      return new BabyKoala();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Order.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Order.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Order.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+
+ at Random
+class Order
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Possum.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Possum.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Possum.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+
+public class Possum
+{
+   
+   public Possum procreate()
+   {
+      return new Possum() {};
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Random.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Random.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/Random.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+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.inject.Qualifier;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at Qualifier
+public @interface Random
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.clazz;
+
+import java.lang.annotation.Annotation;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.enterprise.inject.Stereotype;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.inject.Qualifier;
+
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+//@Artifact
+public class WeldClassTest
+{
+	
+   private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
+   
+   /*
+    * description = "WELD-216"
+    */
+   @Test
+   @Category(Broken.class)
+   public void testMemberClassWithGenericTypes()
+   {
+      AnnotatedType at = WeldClassImpl.of(new Kangaroo().procreate().getClass(), transformer);
+      WeldClassImpl.of(at, transformer);
+   }
+   
+   /*
+    * description = "WELD-216"
+    */
+   @Test
+   public void testLocalClassWithGenericTypes()
+   {
+      AnnotatedType at = WeldClassImpl.of(new Koala().procreate().getClass(), transformer);
+      WeldClassImpl.of(at, transformer);
+   }
+   
+   /*
+    * description = "WELD-216"
+    */
+   @Test
+   public void testAnonymousClassWithGenericTypes()
+   {
+      AnnotatedType at = WeldClassImpl.of(new Possum().procreate().getClass(), transformer);
+      WeldClassImpl.of(at, transformer);
+   }
+   
+   @Test
+   public void testDeclaredAnnotations()
+   {
+      WeldClass<Order> annotatedElement = WeldClassImpl.of(Order.class, transformer);
+      Assert.assertEquals(1, annotatedElement.getAnnotations().size());
+      Assert.assertNotNull(annotatedElement.getAnnotation(Random.class));
+      Assert.assertEquals(Order.class, annotatedElement.getJavaClass());
+   }
+   
+   @Test
+   public void testMetaAnnotations()
+   {
+      WeldClass<Order> annotatedElement = WeldClassImpl.of(Order.class, transformer);
+      Set<Annotation> annotations = annotatedElement.getMetaAnnotations(Qualifier.class);
+      Assert.assertEquals(1, annotations.size());
+      Iterator<Annotation> it = annotations.iterator();
+      Annotation production = it.next();
+      Assert.assertEquals(Random.class, production.annotationType());
+   }
+   
+   @Test
+   public void testEmpty()
+   {
+      WeldClass<Order> annotatedElement = WeldClassImpl.of(Order.class, transformer);
+      Assert.assertNull(annotatedElement.getAnnotation(Stereotype.class));
+      Assert.assertEquals(0, annotatedElement.getMetaAnnotations(Stereotype.class).size());
+      WeldClass<Antelope> classWithNoAnnotations = WeldClassImpl.of(Antelope.class, transformer);
+      Assert.assertEquals(0, classWithNoAnnotations.getAnnotations().size());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/Choice.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/Choice.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/Choice.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.method;
+
+abstract class ChoiceParent<T>
+{
+}
+
+
+class Choice<T, E> extends ChoiceParent<T>
+{
+   public Choice<T, E> aMethod()
+   {
+      return null;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.reflection.method;
+
+import javax.enterprise.util.TypeLiteral;
+
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.introspector.jlr.WeldMethodImpl;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.resources.ClassTransformer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class WeldMethodTest
+{
+	
+   private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
+   private final Class<Choice<?, ?>> CHOICE_LITERAL = new TypeLiteral<Choice<?, ?>>() {}.getRawType();
+   
+   /*
+    * description = "WELD-221"
+    */
+   @Test
+   public void testMethodReturnsGenericTypeOfClass() throws Exception
+   {
+      WeldClass<Choice<?, ?>> clazz = WeldClassImpl.of(CHOICE_LITERAL, transformer);
+      WeldMethod<Choice<?, ?>, Choice<?, ?>> method = WeldMethodImpl.of(Choice.class.getMethod("aMethod"), clazz, transformer);
+      Assert.assertEquals(3, method.getTypeClosure().size());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,208 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.security;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.jboss.weld.util.reflection.SecureReflections;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ReflectionTest
+{
+
+   @Test
+   public void testGetField() throws NoSuchFieldException
+   {
+      Assert.assertNotNull(SecureReflections.getField(TestObject.class, "publicField"));
+   }
+
+   @Test(expected = NoSuchFieldException.class)
+   public void testGetFieldNotFound() throws NoSuchFieldException
+   {
+      SecureReflections.getField(TestObject.class, "eioota");
+   }
+
+   @Test
+   public void testGetDeclaredField() throws SecurityException, NoSuchFieldException
+   {
+      Assert.assertNotNull(SecureReflections.getDeclaredField(TestObject.class, "publicField"));
+   }
+
+   @Test(expected = NoSuchFieldException.class)
+   public void testGetDeclaredFieldNotFound() throws NoSuchFieldException
+   {
+      SecureReflections.getDeclaredField(TestObject.class, "eioota");
+   }
+
+   @Test
+   public void testGetFields()
+   {
+      Assert.assertEquals(1, SecureReflections.getFields(TestObject.class).length);
+   }
+
+   @Test
+   public void testGetDeclaredFields()
+   {
+      Assert.assertEquals(2, SecureReflections.getDeclaredFields(TestObject.class).length);
+   }
+
+   @Test
+   public void testFieldAccess()
+   {
+      testAllAccessible(grantAccess(SecureReflections.getDeclaredFields(TestObject.class)));
+   }
+   
+   private AccessibleObject[] grantAccess(AccessibleObject[] objects) {
+      for (AccessibleObject object : objects)
+      {
+         if (object instanceof Field) {
+            SecureReflections.ensureAccessible((Field) object);
+         } else if (object instanceof Method) {
+            SecureReflections.ensureAccessible((Method) object);
+         } else if (object instanceof Constructor<?>) {
+            SecureReflections.ensureAccessible((Constructor<?>)object);
+         }
+      }
+      return objects;
+   }
+   
+   private void testAllAccessible(AccessibleObject[] objects)
+   {
+      for (AccessibleObject object : objects)
+      {
+         if (!object.isAccessible())
+         {
+            Assert.fail();
+         }
+      }
+   }
+
+   @Test
+   public void testGetMethod() throws NoSuchMethodException
+   {
+      Assert.assertNotNull(SecureReflections.getMethod(TestObject.class, "publicTest", new Class<?>[] { String.class }));
+   }
+
+   @Test(expected = NoSuchMethodException.class)
+   public void testGetMethodNotFound() throws NoSuchMethodException
+   {
+      SecureReflections.getMethod(TestObject.class, "xpublicTest", new Class<?>[] { String.class });
+   }
+
+   @Test
+   public void testGetDeclaredMethod() throws NoSuchMethodException
+   {
+      Assert.assertNotNull(SecureReflections.getDeclaredMethod(TestObject.class, "publicTest", new Class<?>[] { String.class }));
+   }
+
+   @Test(expected = NoSuchMethodException.class)
+   public void testGetDeclaredMethodNotFound() throws NoSuchMethodException
+   {
+      SecureReflections.getDeclaredMethod(TestObject.class, "xpublicTest", new Class<?>[] { String.class });
+   }
+
+   @Test
+   public void testGetMethods()
+   {
+      Assert.assertEquals(10, SecureReflections.getMethods(TestObject.class).length);
+   }
+
+   @Test
+   public void testGetDeclaredMethods()
+   {
+      Assert.assertEquals(2, SecureReflections.getDeclaredMethods(TestObject.class).length);
+   }
+
+   @Test
+   public void testMethodAccess()
+   {
+      testAllAccessible(grantAccess(SecureReflections.getDeclaredMethods(TestObject.class)));
+   }
+
+   @Test
+   public void testGetConstructor() throws NoSuchMethodException
+   {
+      Assert.assertNotNull(SecureReflections.getConstructor(TestObject.class, new Class<?>[] { Integer.class }));
+   }
+
+   @Test(expected = NoSuchMethodException.class)
+   public void testGetConstructorNotFound() throws NoSuchMethodException
+   {
+      SecureReflections.getConstructor(TestObject.class, new Class<?>[] { Float.class });
+   }
+
+   @Test
+   public void testGetDeclaredConstructor() throws NoSuchMethodException
+   {
+      Assert.assertNotNull(SecureReflections.getDeclaredConstructor(TestObject.class, new Class<?>[] { String.class }));
+   }
+
+   @Test(expected = NoSuchMethodException.class)
+   public void testGetDeclaredConstructorNotFound() throws NoSuchMethodException
+   {
+      SecureReflections.getDeclaredConstructor(TestObject.class, new Class<?>[] { Float.class });
+   }
+
+   @Test
+   public void testGetConstructors()
+   {
+      Assert.assertEquals(2, SecureReflections.getConstructors(TestObject.class).length);
+   }
+
+   @Test
+   public void testGetDeclaredConstructors()
+   {
+      Assert.assertEquals(3, SecureReflections.getDeclaredConstructors(TestObject.class).length);
+   }
+
+   @Test
+   public void testConstructorAccess()
+   {
+      testAllAccessible(grantAccess(SecureReflections.getDeclaredConstructors(TestObject.class)));
+   }
+
+   @Test
+   public void testNewInstance() throws InstantiationException, IllegalAccessException
+   {
+      Assert.assertNotNull(SecureReflections.newInstance(TestObject.class));
+   }
+
+   @Test
+   public void testInvoke() throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
+   {
+      TestObject to = new TestObject();
+      Method m = TestObject.class.getMethod("publicTest", new Class<?>[] { String.class });
+      Assert.assertEquals("foo", SecureReflections.invoke(to, m, ""));
+   }
+   
+   @Test
+   public void testLookupMethod() throws NoSuchMethodException 
+   {
+      Assert.assertNotNull(SecureReflections.lookupMethod(TestObject.class, "rootOfAllEvil", new Class<?>[]{}));
+   }
+   
+   @Test(expected = NoSuchMethodException.class)
+   public void testLookupMethodNotFound() throws NoSuchMethodException 
+   {
+      Assert.assertNotNull(SecureReflections.lookupMethod(TestObject.class, "eioota", new Class<?>[]{}));
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.security;
+
+import java.lang.reflect.Field;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+public class SecurityTest
+{
+   
+   private String foo;
+   
+   @Test
+   public void testSetAccessibleDoesNotPropagate() throws Exception
+   {
+      Field field = SecurityTest.class.getDeclaredField("foo");
+      Assert.assertFalse(field.isAccessible());
+      field.setAccessible(true);
+      Assert.assertTrue(field.isAccessible());
+      Assert.assertFalse(SecurityTest.class.getDeclaredField("foo").isAccessible());
+      Assert.assertFalse(SecurityTest.class.getDeclaredField("foo") == SecurityTest.class.getDeclaredField("foo"));
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SuperTestObject.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SuperTestObject.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SuperTestObject.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.security;
+
+public class SuperTestObject
+{
+   protected void rootOfAllEvil() {};
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/TestObject.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/TestObject.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/TestObject.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.security;
+
+public class TestObject extends SuperTestObject
+{
+   private String privateField;
+   public String publicField;
+   
+   private TestObject(String test)
+   {
+   }
+   
+   public TestObject() {};
+   
+   public TestObject(Integer test) {
+   }
+
+   private void privateTest(String test)
+   {
+   }
+   
+   public String publicTest(String test) 
+   {
+      return "foo";
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.util;
+
+import java.util.Iterator;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.util.AnnotationLiteral;
+
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+import org.jboss.weld.util.AnnotatedTypes;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test comparison and id creation for AnnotatedTypes
+ * @author Stuart Douglas <stuart at baileyroberts.com.au>
+ *
+ */
+public class AnnotatedTypesTest
+{
+   /**
+    * tests the AnnotatedTypes.compareAnnotatedTypes 
+    */
+   @Test
+   public void testComparison() throws SecurityException, NoSuchFieldException, NoSuchMethodException
+   {
+      //check that two weld classes on the same underlying are equal
+      TypeStore ts = new TypeStore();
+      ClassTransformer ct =new ClassTransformer(ts);
+      WeldClass<Chair> chair1 = WeldClassImpl.of(Chair.class,ct);
+      WeldClass<Chair> chair2 = WeldClassImpl.of(Chair.class,ct);
+      Assert.assertTrue(AnnotatedTypes.compareAnnotatedTypes(chair1, chair2));
+      
+      //check that a different implementation of annotated type is equal to the weld implementation
+      TestAnnotatedTypeBuilder<Chair> builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToClass(new DefaultLiteral());
+      builder.addToField(Chair.class.getField("legs"), new ProducesLiteral());
+      builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());
+      AnnotatedType<Chair> chair3 = builder.create();
+      Assert.assertTrue(AnnotatedTypes.compareAnnotatedTypes(chair1, chair3));
+      
+      //check that the implementation returns false if a field annotation changes
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToClass(new DefaultLiteral());
+      builder.addToField(Chair.class.getField("legs"), new DefaultLiteral());
+      builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());     
+      chair3 = builder.create();
+      Assert.assertFalse(AnnotatedTypes.compareAnnotatedTypes(chair1, chair3));
+      
+      //check that the implementation returns false if a class level annotation changes
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToClass(new ProducesLiteral());
+      builder.addToField(Chair.class.getField("legs"), new DefaultLiteral());
+      builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral()); 
+      chair3 = builder.create();
+      Assert.assertFalse(AnnotatedTypes.compareAnnotatedTypes(chair1, chair3));
+      
+   }
+   
+   @Test
+   public void testFieldId() throws SecurityException, NoSuchFieldException
+   {
+      TestAnnotatedTypeBuilder<Chair> builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToField(Chair.class.getField("legs"), new ProducesLiteral());
+      AnnotatedType<Chair> chair3 = builder.create();
+      AnnotatedField<? super Chair> field = chair3.getFields().iterator().next();
+      String id = AnnotatedTypes.createFieldId(field);
+      Assert.assertEquals("wrong id for field :" + id,
+            "org.jboss.weld.tests.unit.util.Chair.legs[@javax.enterprise.inject.Produces()]", id);
+      
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      chair3 = builder.create();
+      field = chair3.getFields().iterator().next();
+      id = AnnotatedTypes.createFieldId(field);
+      Assert.assertEquals("wrong id for field :" + id,
+            "org.jboss.weld.tests.unit.util.Chair.legs", id);
+      
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToField(Chair.class.getField("legs"), new ComfyChairLiteral());
+      chair3 = builder.create();
+      field = chair3.getFields().iterator().next();
+      id = AnnotatedTypes.createFieldId(field);
+      Assert.assertEquals("wrong id for field :" + id,
+            "org.jboss.weld.tests.unit.util.Chair.legs[@org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]", id);
+   }
+   
+   @Test
+   public void testMethodId() throws SecurityException, NoSuchMethodException
+   {
+      TestAnnotatedTypeBuilder<Chair> builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());
+      AnnotatedType<Chair> chair3 = builder.create();
+      Iterator<AnnotatedMethod<? super Chair>> it = chair3.getMethods().iterator();
+      AnnotatedMethod<? super Chair> method = it.next();
+      while(!method.getJavaMember().getName().equals("sit"))method = it.next();
+      String id = AnnotatedTypes.createCallableId(method);
+      Assert.assertEquals("wrong id for method :" + id, 
+            "org.jboss.weld.tests.unit.util.Chair.sit[@javax.enterprise.inject.Produces()]()", id);
+      
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      chair3 = builder.create();
+      it = chair3.getMethods().iterator();
+      method = it.next();
+      while(!method.getJavaMember().getName().equals("sit"))method = it.next();
+      id = AnnotatedTypes.createCallableId(method);
+      Assert.assertEquals("wrong id for method :" + id,
+            "org.jboss.weld.tests.unit.util.Chair.sit()", id);
+      
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToMethod(Chair.class.getMethod("sit"), new ComfyChairLiteral());
+      chair3 = builder.create();
+      it = chair3.getMethods().iterator();
+      method = it.next();
+      while(!method.getJavaMember().getName().equals("sit"))method = it.next();
+      id = AnnotatedTypes.createCallableId(method);
+      Assert.assertEquals("wrong id for method :" + id,
+            "org.jboss.weld.tests.unit.util.Chair.sit[@org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]()", id);
+   }
+   
+   @Test
+   public void testTypeId() throws SecurityException, NoSuchMethodException
+   {
+      TestAnnotatedTypeBuilder<Chair> builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());
+      AnnotatedType<Chair> chair3 = builder.create();
+      String id = AnnotatedTypes.createTypeId(chair3);
+      Assert.assertEquals("wrong id for type :" + id, 
+            "org.jboss.weld.tests.unit.util.Chair{org.jboss.weld.tests.unit.util.Chair.sit[@javax.enterprise.inject.Produces()]();}", id);
+      
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      chair3 = builder.create();
+      id = AnnotatedTypes.createTypeId(chair3);
+      Assert.assertEquals("wrong id for type :" + id,
+            "org.jboss.weld.tests.unit.util.Chair{}", id);
+      
+      builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
+      builder.addToMethod(Chair.class.getMethod("sit"), new ComfyChairLiteral());
+      chair3 = builder.create();
+      id = AnnotatedTypes.createTypeId(chair3);
+      Assert.assertEquals("wrong id for type :" + id,
+            "org.jboss.weld.tests.unit.util.Chair{org.jboss.weld.tests.unit.util.Chair.sit[@org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]();}", id);
+   }
+   
+   private static class DefaultLiteral extends AnnotationLiteral<Default> implements Default {}
+   private static class ProducesLiteral extends AnnotationLiteral<Produces> implements Produces {}
+   private static class ComfyChairLiteral extends AnnotationLiteral<ComfyChair> implements ComfyChair 
+   {
+      public int softness()
+      {
+         return 1;
+      }
+      
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/Chair.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/Chair.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/Chair.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.util;
+
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+
+ at Default
+public class Chair
+{
+   @Produces
+   public int legs;
+   
+   @Produces
+   public String sit()
+   {
+      return "sitting";
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/ComfyChair.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/ComfyChair.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/ComfyChair.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.unit.util;
+
+public @interface ComfyChair
+{
+   int softness();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedCallable.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedCallable.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedCallable.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+abstract class AbstractTestAnnotatedCallable<X, Y extends Member> extends AbstractTestAnnotatedMember<X, Y> implements AnnotatedCallable<X>
+{
+
+   private final List<AnnotatedParameter<X>> parameters;
+
+   protected AbstractTestAnnotatedCallable(AnnotatedType<X> declaringType, Y member, Class<?> memberType, Class<?>[] parameterTypes, TestAnnotationStore annotations, Map<Integer, TestAnnotationStore> parameterAnnotations)
+   {
+      super(declaringType, member, memberType, annotations);
+      this.parameters = getAnnotatedParameters(this, parameterTypes, parameterAnnotations);
+   }
+
+   public List<AnnotatedParameter<X>> getParameters()
+   {
+      return Collections.unmodifiableList(parameters);
+   }
+
+   public AnnotatedParameter<X> getParameter(int index)
+   {
+      return parameters.get(index);
+
+   }  
+   
+   private static <X, Y extends Member> List<AnnotatedParameter<X>> getAnnotatedParameters(AbstractTestAnnotatedCallable<X, Y> callable, Class<?>[] parameterTypes, Map<Integer, TestAnnotationStore> parameterAnnotations)
+   {
+      List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>();
+      int len = parameterTypes.length;
+      for (int i = 0; i < len; ++i)
+      {
+         TestAnnotationBuilder builder = new TestAnnotationBuilder();
+         if (parameterAnnotations != null && parameterAnnotations.containsKey(i))
+         {
+            builder.addAll(parameterAnnotations.get(i));
+         }
+         TestAnnotatedParameter<X> p = new TestAnnotatedParameter<X>(callable, parameterTypes[i], i, builder.create());
+         parameters.add(p);
+      }
+      return parameters;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedElement.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedElement.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedElement.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+
+/**
+ * The base class for all New Annotated types.
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+abstract class AbstractTestAnnotatedElement implements Annotated
+{
+
+   private final Class<?> type;
+   private final Set<Type> typeClosure;
+   private final TestAnnotationStore annotations;
+
+   protected AbstractTestAnnotatedElement(Class<?> type, TestAnnotationStore annotations)
+   {
+      this.typeClosure = new TestTypeClosureBuilder().add(type).getTypes();
+      if (annotations == null)
+      {
+         this.annotations = new TestAnnotationStore();
+      }
+      else
+      {
+         this.annotations = annotations;
+      }
+      this.type = type;
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      return annotations.getAnnotation(annotationType);
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      return annotations.getAnnotations();
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return annotations.isAnnotationPresent(annotationType);
+   }
+
+   public Set<Type> getTypeClosure()
+   {
+      return Collections.unmodifiableSet(typeClosure);
+   }
+
+   public Type getBaseType()
+   {
+      return type;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedMember.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedMember.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/AbstractTestAnnotatedMember.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Modifier;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+abstract class AbstractTestAnnotatedMember<X, M extends Member> extends AbstractTestAnnotatedElement implements AnnotatedMember<X>
+{
+   private final AnnotatedType<X> declaringType;
+   private final M javaMember;
+
+   protected AbstractTestAnnotatedMember(AnnotatedType<X> declaringType, M member, Class<?> memberType, TestAnnotationStore annotations)
+   {
+      super(memberType, annotations);
+      this.declaringType = declaringType;
+      this.javaMember = member;
+   }
+
+   public AnnotatedType<X> getDeclaringType()
+   {
+      return declaringType;
+   }
+
+   public M getJavaMember()
+   {
+      return javaMember;
+   }
+
+   public boolean isStatic()
+   {
+      return Modifier.isStatic(javaMember.getModifiers());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedConstructor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedConstructor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedConstructor.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.reflect.Constructor;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class TestAnnotatedConstructor<X> extends AbstractTestAnnotatedCallable<X, Constructor<X>> implements AnnotatedConstructor<X>
+{
+
+   TestAnnotatedConstructor(TestAnnotatedType<X> type, Constructor<?> constructor, TestAnnotationStore annotations, Map<Integer, TestAnnotationStore> parameterAnnotations)
+   {
+      super(type, (Constructor<X>) constructor, constructor.getDeclaringClass(), constructor.getParameterTypes(), annotations, parameterAnnotations);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedField.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedField.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedField.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.reflect.Field;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ *
+ */
+class TestAnnotatedField<X> extends AbstractTestAnnotatedMember<X, Field> implements AnnotatedField<X>
+{
+
+   TestAnnotatedField(AnnotatedType<X> declaringType, Field field, TestAnnotationStore annotations)
+   {
+      super(declaringType, field, field.getType(), annotations);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedMethod.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedMethod.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedMethod.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class TestAnnotatedMethod<X> extends AbstractTestAnnotatedCallable<X, Method> implements AnnotatedMethod<X>
+{
+   TestAnnotatedMethod(AnnotatedType<X> type, Method method, TestAnnotationStore annotations, Map<Integer, TestAnnotationStore> parameterAnnotations)
+   {
+      super(type, method, method.getReturnType(), method.getParameterTypes(), annotations, parameterAnnotations);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedParameter.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedParameter.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedParameter.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+/**
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class TestAnnotatedParameter<X> extends AbstractTestAnnotatedElement implements AnnotatedParameter<X>
+{
+
+   private final int position;
+   private final AnnotatedCallable<X> declaringCallable;
+
+   TestAnnotatedParameter(AnnotatedCallable<X> declaringCallable, Class<?> type, int position, TestAnnotationStore annotations)
+   {
+      super(type, annotations);
+      this.declaringCallable = declaringCallable;
+      this.position = position;
+   }
+
+   public AnnotatedCallable<X> getDeclaringCallable()
+   {
+      return declaringCallable;
+   }
+
+   public int getPosition()
+   {
+      return position;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedType.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedType.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedType.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * AnnotatedType implementation for adding beans in the BeforeBeanDiscovery
+ * event
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class TestAnnotatedType<X> extends AbstractTestAnnotatedElement implements AnnotatedType<X>
+{
+
+   private final Set<AnnotatedConstructor<X>> constructors;
+   private final Set<AnnotatedField<? super X>> fields;
+   private final Set<AnnotatedMethod<? super X>> methods;
+
+   private final Class<X> javaClass;
+
+   TestAnnotatedType(Class<X> clazz, TestAnnotationStore typeAnnotations, Map<Field, TestAnnotationStore> fieldAnnotations, Map<Method, TestAnnotationStore> methodAnnotations, Map<Method, Map<Integer, TestAnnotationStore>> methodParameterAnnotations, Map<Constructor<X>, TestAnnotationStore> constructorAnnotations, Map<Constructor<X>, Map<Integer, TestAnnotationStore>> constructorParameterAnnotations)
+   {
+      super(clazz, typeAnnotations);
+      this.javaClass = clazz;
+      this.constructors = new HashSet<AnnotatedConstructor<X>>();
+      for (Constructor<?> c : clazz.getDeclaredConstructors())
+      {
+         TestAnnotatedConstructor<X> nc = new TestAnnotatedConstructor<X>(this, c, constructorAnnotations.get(c), constructorParameterAnnotations.get(c));
+         constructors.add(nc);
+      }
+      this.methods = new HashSet<AnnotatedMethod<? super X>>();
+      for (Method m : clazz.getDeclaredMethods())
+      {
+         TestAnnotatedMethod<X> met = new TestAnnotatedMethod<X>(this, m, methodAnnotations.get(m), methodParameterAnnotations.get(m));
+         methods.add(met);
+      }
+      this.fields = new HashSet<AnnotatedField<? super X>>();
+      for (Field f : clazz.getDeclaredFields())
+      {
+         TestAnnotatedField<X> b = new TestAnnotatedField<X>(this, f, fieldAnnotations.get(f));
+         fields.add(b);
+      }
+   }
+
+   public Set<AnnotatedConstructor<X>> getConstructors()
+   {
+      return Collections.unmodifiableSet(constructors);
+   }
+
+   public Set<AnnotatedField<? super X>> getFields()
+   {
+      return Collections.unmodifiableSet(fields);
+   }
+
+   public Class<X> getJavaClass()
+   {
+      return javaClass;
+   }
+
+   public Set<AnnotatedMethod<? super X>> getMethods()
+   {
+      return Collections.unmodifiableSet(methods);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedTypeBuilder.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedTypeBuilder.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotatedTypeBuilder.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Class for constructing a new AnnotatedType. A new instance of builder must be
+ * used for each annotated type.
+ * 
+ * No annotations will be read from the underlying class definition, all
+ * annotations must be added explicitly
+ * 
+ * @author Stuart Douglas
+ * @author Pete Muir
+ * 
+ */
+public class TestAnnotatedTypeBuilder<X>
+{
+   private Map<Field, TestAnnotationBuilder> fields = new HashMap<Field, TestAnnotationBuilder>();
+   private Map<Method, TestAnnotationBuilder> methods = new HashMap<Method, TestAnnotationBuilder>();
+   private Map<Method, Map<Integer, TestAnnotationBuilder>> methodParameters = new HashMap<Method, Map<Integer, TestAnnotationBuilder>>();
+   private Map<Constructor<X>, TestAnnotationBuilder> constructors = new HashMap<Constructor<X>, TestAnnotationBuilder>();
+   private Map<Constructor<X>, Map<Integer, TestAnnotationBuilder>> constructorParameters = new HashMap<Constructor<X>, Map<Integer, TestAnnotationBuilder>>();
+   private TestAnnotationBuilder typeAnnotations = new TestAnnotationBuilder();
+   private Class<X> underlying;
+
+   public TestAnnotatedTypeBuilder(Class<X> underlying)
+   {
+      this.underlying = underlying;
+   
+   }
+
+   public TestAnnotatedTypeBuilder<X> addToClass(Annotation a)
+   {
+      typeAnnotations.add(a);
+      return this;
+   }
+
+   public TestAnnotatedTypeBuilder<X> addToField(Field field, Annotation a)
+   {
+      TestAnnotationBuilder annotations = fields.get(field);
+      if (annotations == null)
+      {
+         annotations = new TestAnnotationBuilder();
+         fields.put(field, annotations);
+      }
+      annotations.add(a);
+      return this;
+   }
+
+   public TestAnnotatedTypeBuilder<X> addToMethod(Method method, Annotation a)
+   {
+      TestAnnotationBuilder annotations = methods.get(method);
+      if (annotations == null)
+      {
+         annotations = new TestAnnotationBuilder();
+         methods.put(method, annotations);
+      }
+      annotations.add(a);
+      return this;
+   }
+
+   public TestAnnotatedTypeBuilder<X> addToMethodParameter(Method method, int parameter, Annotation a)
+   {
+      Map<Integer, TestAnnotationBuilder> anmap = methodParameters.get(method);
+      if (anmap == null)
+      {
+         anmap = new HashMap<Integer, TestAnnotationBuilder>();
+         methodParameters.put(method, anmap);
+      }
+      TestAnnotationBuilder annotations = anmap.get(parameter);
+      if (annotations == null)
+      {
+         annotations = new TestAnnotationBuilder();
+         anmap.put(parameter, annotations);
+      }
+      annotations.add(a);
+      return this;
+   }
+
+   public TestAnnotatedTypeBuilder<X> addToConstructor(Constructor<X> constructor, Annotation a)
+   {
+      TestAnnotationBuilder annotations = constructors.get(constructor);
+      if (annotations == null)
+      {
+         annotations = new TestAnnotationBuilder();
+         constructors.put(constructor, annotations);
+      }
+      annotations.add(a);
+      return this;
+   }
+
+   public TestAnnotatedTypeBuilder<X> addToConstructorParameter(Constructor<X> constructor, int parameter, Annotation a)
+   {
+      Map<Integer, TestAnnotationBuilder> anmap = constructorParameters.get(constructor);
+      if (anmap == null)
+      {
+         anmap = new HashMap<Integer, TestAnnotationBuilder>();
+         constructorParameters.put(constructor, anmap);
+      }
+      TestAnnotationBuilder annotations = anmap.get(parameter);
+      if (annotations == null)
+      {
+         annotations = new TestAnnotationBuilder();
+         anmap.put(parameter, annotations);
+      }
+      annotations.add(a);
+      return this;
+   }
+
+   public AnnotatedType<X> create()
+   {
+      Map<Constructor<X>, Map<Integer, TestAnnotationStore>> constructorParameterAnnnotations = new HashMap<Constructor<X>, Map<Integer,TestAnnotationStore>>();
+      Map<Constructor<X>, TestAnnotationStore> constructorAnnotations = new HashMap<Constructor<X>, TestAnnotationStore>();
+      Map<Method, Map<Integer, TestAnnotationStore>> methodParameterAnnnotations = new HashMap<Method, Map<Integer,TestAnnotationStore>>();
+      Map<Method, TestAnnotationStore> methodAnnotations = new HashMap<Method, TestAnnotationStore>();
+      Map<Field, TestAnnotationStore> fieldAnnotations = new HashMap<Field, TestAnnotationStore>();
+      
+      for (Entry<Field, TestAnnotationBuilder> e : fields.entrySet())
+      {
+         fieldAnnotations.put(e.getKey(), e.getValue().create());
+      }
+      
+      for (Entry<Method, TestAnnotationBuilder> e : methods.entrySet())
+      {
+         methodAnnotations.put(e.getKey(), e.getValue().create());
+      }
+      for (Entry<Method, Map<Integer, TestAnnotationBuilder>> e : methodParameters.entrySet())
+      {
+         Map<Integer, TestAnnotationStore> parameterAnnotations = new HashMap<Integer, TestAnnotationStore>();
+         methodParameterAnnnotations.put(e.getKey(), parameterAnnotations);
+         for (Entry<Integer, TestAnnotationBuilder> pe : e.getValue().entrySet())
+         {
+            parameterAnnotations.put(pe.getKey(), pe.getValue().create());
+         }
+      }
+      
+      for (Entry<Constructor<X>, TestAnnotationBuilder> e : constructors.entrySet())
+      {
+         constructorAnnotations.put(e.getKey(), e.getValue().create());
+      }
+      for (Entry<Constructor<X>, Map<Integer, TestAnnotationBuilder>> e : constructorParameters.entrySet())
+      {
+         Map<Integer, TestAnnotationStore> parameterAnnotations = new HashMap<Integer, TestAnnotationStore>();
+         constructorParameterAnnnotations.put(e.getKey(), parameterAnnotations);
+         for (Entry<Integer, TestAnnotationBuilder> pe : e.getValue().entrySet())
+         {
+            parameterAnnotations.put(pe.getKey(), pe.getValue().create());
+         }
+      }
+
+      return new TestAnnotatedType<X>(underlying, typeAnnotations.create(), fieldAnnotations, methodAnnotations, methodParameterAnnnotations, constructorAnnotations, constructorParameterAnnnotations);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationBuilder.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationBuilder.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationBuilder.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * 
+ * @author Stuart Douglas
+ *
+ */
+class TestAnnotationBuilder
+{
+   private HashMap<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+   private Set<Annotation> annotationSet = new HashSet<Annotation>();
+
+   public TestAnnotationBuilder add(Annotation a)
+   {
+      annotationSet.add(a);
+      annotationMap.put(a.getClass(), a);
+      return this;
+   }
+
+   public TestAnnotationStore create()
+   {
+      return new TestAnnotationStore(annotationMap, annotationSet);
+   }
+   
+   public TestAnnotationBuilder addAll(Set<Annotation> annotations)
+   {
+      for (Annotation annotation : annotations)
+      {
+         add(annotation);
+      }
+      return this;
+   }
+   
+   public TestAnnotationBuilder addAll(TestAnnotationStore annotations)
+   {
+      for (Annotation annotation : annotations.getAnnotations())
+      {
+         add(annotation);
+      }
+      return this;
+   }
+
+   public TestAnnotationBuilder addAll(AnnotatedElement element)
+   {
+      for (Annotation a : element.getAnnotations())
+      {
+         add(a);
+      }
+      return this;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationStore.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationStore.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestAnnotationStore.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * 
+ * @author Stuart Douglas
+ *
+ */
+class TestAnnotationStore
+{
+   
+   private final HashMap<Class<? extends Annotation>, Annotation> annotationMap;
+   private final Set<Annotation> annotationSet;
+
+   TestAnnotationStore(HashMap<Class<? extends Annotation>, Annotation> annotationMap, Set<Annotation> annotationSet)
+   {
+      this.annotationMap = annotationMap;
+      this.annotationSet = annotationSet;
+   }
+   
+   TestAnnotationStore()
+   {
+      this.annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+      this.annotationSet = new HashSet<Annotation>();
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      return annotationType.cast(annotationMap.get(annotationType));
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      return Collections.unmodifiableSet(annotationSet);
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return annotationMap.containsKey(annotationType);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestTypeClosureBuilder.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestTypeClosureBuilder.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/TestTypeClosureBuilder.java	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.util.annotated;
+
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A type closure builder
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+class TestTypeClosureBuilder
+{
+
+   final Set<Type> types = new HashSet<Type>();
+
+   public TestTypeClosureBuilder add(Class<?> beanType)
+   {
+      Class<?> c = beanType;
+      do
+      {
+         types.add(c);
+         c = c.getSuperclass();
+      }
+      while (c != null);
+      for (Class<?> i : beanType.getInterfaces())
+      {
+         types.add(i);
+      }
+      return this;
+   }
+
+   public TestTypeClosureBuilder addInterfaces(Class<?> beanType)
+   {
+      for (Class<?> i : beanType.getInterfaces())
+      {
+         types.add(i);
+      }
+      return this;
+   }
+
+   public Set<Type> getTypes()
+   {
+      return types;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/resources/arquillian.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/arquillian.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/arquillian.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<arquillian xmlns="http://jboss.com/arquillian"
+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+		xmlns:jboss="urn:arq:org.jboss.arquillian.container.jbossas.managed_6">
+
+	<engine>
+		<maxDeploymentsBeforeRestart>20</maxDeploymentsBeforeRestart>
+	</engine>
+	
+	<jboss:container>
+<!--		<jboss:jbossHome>/home/aslak/dev/servers/jboss-6.0.0.M3/</jboss:jbossHome> --> <!-- default %JBOSS_HOME% -->
+<!--		<jboss:javaHome>/usr/lib/jvm/java-6-openjdk</jboss:javaHome> -->  <!-- default %JAVA_HOME% -->
+	</jboss:container>	
+
+</arquillian>

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/builtinBeans/ee/persistence.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/builtinBeans/ee/persistence.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/builtinBeans/ee/persistence.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
+             version="1.0">
+   <persistence-unit name="test">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+   </persistence-unit>
+</persistence>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/enterprise/ejb-jar.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/enterprise/ejb-jar.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/enterprise/ejb-jar.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" 
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
+         version="3.1">
+   
+</ejb-jar>

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/resolution/circular/resource/persistence.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/resolution/circular/resource/persistence.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/resolution/circular/resource/persistence.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
+             version="1.0">
+   <persistence-unit name="test">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+   </persistence-unit>
+</persistence>

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/javax.enterprise.inject.spi.Extension
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/javax.enterprise.inject.spi.Extension	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1 @@
+org.jboss.weld.tests.unit.bootstrap.InitializedObserver

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/alternative.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/alternative.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/alternative.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,5 @@
+<beans>
+	<alternatives>
+		<class>org.jboss.weld.tests.unit.bootstrap.xml.Alt</class>
+	</alternatives>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/decorator.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/decorator.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/decorator.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,5 @@
+<beans>
+	<decorators>
+		<class>org.jboss.weld.tests.unit.bootstrap.xml.Dec</class>
+	</decorators>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/interceptor.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/interceptor.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/interceptor.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,5 @@
+<beans>
+	<interceptors>
+		<class>org.jboss.weld.tests.unit.bootstrap.xml.Int</class>
+	</interceptors>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleAlternativeBlocks.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleAlternativeBlocks.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleAlternativeBlocks.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,8 @@
+<beans>
+	<alternatives>
+		<class>org.jboss.weld.tests.unit.bootstrap.Foo</class>
+	</alternatives>
+	<alternatives>
+		<class>org.jboss.weld.tests.unit.bootstrap.Bar</class>
+	</alternatives>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleDecoratorBlocks.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleDecoratorBlocks.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleDecoratorBlocks.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,8 @@
+<beans>
+	<decorators>
+		<class>org.jboss.weld.tests.unit.bootstrap.Foo</class>
+	</decorators>
+	<decorators>
+		<class>org.jboss.weld.tests.unit.bootstrap.Bar</class>
+	</decorators>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleInterceptorsBlocks.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleInterceptorsBlocks.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/multipleInterceptorsBlocks.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,8 @@
+<beans>
+	<interceptors>
+		<class>org.jboss.weld.tests.unit.bootstrap.Foo</class>
+	</interceptors>
+	<interceptors>
+		<class>org.jboss.weld.tests.unit.bootstrap.Bar</class>
+	</interceptors>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/namespaced.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/namespaced.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/namespaced.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,11 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xmlns:s="urn:java:seam:core" 
+   xmlns:p="org.jboss.seam.xml.examples.princess"
+   xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee 
+      http://docs.jboss.org/cdi/beans_1_0.xsd">
+	<alternatives>
+		<class>org.jboss.weld.tests.unit.bootstrap.xml.Alt</class>
+	</alternatives>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonDefaultNamespaced.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonDefaultNamespaced.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonDefaultNamespaced.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,12 @@
+<ee:beans xmlns:ee="http://java.sun.com/xml/ns/javaee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xmlns="urn:java:seam:core" 
+   xmlns:p="org.jboss.seam.xml.examples.princess"
+   xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee 
+      http://docs.jboss.org/cdi/beans_1_0.xsd">
+	<ee:alternatives>
+		<ee:class>org.jboss.weld.tests.unit.bootstrap.xml.Alt</ee:class>
+	</ee:alternatives>
+   <foo />
+</ee:beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonPrettyPrinted.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonPrettyPrinted.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/nonPrettyPrinted.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1 @@
+<beans><alternatives><class>org.jboss.weld.tests.unit.bootstrap.xml.Alt</class></alternatives></beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unloadable.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unloadable.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unloadable.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,5 @@
+<beans>
+	<alternatives>
+		<class>foo.Bar</class>
+	</alternatives>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unparseable.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unparseable.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/bootstrap/xml/unparseable.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,5 @@
+<beans>
+	<alternatives
+		<class>foo.Bar</class>
+	</alternatives>
+</beans>
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/extensions/javax.enterprise.inject.spi.Extension
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/extensions/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/extensions/javax.enterprise.inject.spi.Extension	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,4 @@
+org.jboss.weld.tests.unit.deployment.structure.extensions.Observer1
+org.jboss.weld.tests.unit.deployment.structure.extensions.Observer2
+org.jboss.weld.tests.unit.deployment.structure.extensions.CountingObserver1
+org.jboss.weld.tests.unit.deployment.structure.extensions.CountingObserver2

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/beans.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/beans.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/beans.xml	2010-07-28 10:18:08 UTC (rev 6820)
@@ -0,0 +1,5 @@
+<beans>
+	<alternatives>
+		<class>org.jboss.weld.tests.unit.deployment.structure.nonTransitiveResolution.Alt</class>
+	</alternatives>
+</beans>
\ No newline at end of file



More information about the weld-commits mailing list