[weld-commits] Weld SVN: r6422 - in core/trunk: tests-arquillian and 52 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Fri Jun 11 14:54:35 EDT 2010


Author: aslak
Date: 2010-06-11 14:54:33 -0400 (Fri, 11 Jun 2010)
New Revision: 6422

Added:
   core/trunk/tests-arquillian/
   core/trunk/tests-arquillian/pom.xml
   core/trunk/tests-arquillian/src/
   core/trunk/tests-arquillian/src/main/
   core/trunk/tests-arquillian/src/main/java/
   core/trunk/tests-arquillian/src/main/java/org/
   core/trunk/tests-arquillian/src/main/java/org/jboss/
   core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/
   core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/
   core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/
   core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/ClusterClassLoader.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableCLProxyServices.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableMockEELifecycle.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableSingletonProvider.java
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/el/
   core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/el/EL.java
   core/trunk/tests-arquillian/src/main/resources/
   core/trunk/tests-arquillian/src/main/resources/META-INF/
   core/trunk/tests-arquillian/src/main/resources/META-INF/services/
   core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive
   core/trunk/tests-arquillian/src/test/
   core/trunk/tests-arquillian/src/test/java/
   core/trunk/tests-arquillian/src/test/java/org/
   core/trunk/tests-arquillian/src/test/java/org/jboss/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Test.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/Foo.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedCallable.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedConstructor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedField.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMember.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMethod.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedParameter.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedType.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/NotAnnotated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Frame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Window.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorDeploymentObserver.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/Decorated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecorated.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Intercepted.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Service.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account1.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account2.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/AccountDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/DecoratorResolutionTestsHelper.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleDecorator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SomeBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Game.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Generator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockSentenceTranslator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Random.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/SentenceParser.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/SentenceTranslator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/TextTranslator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Translator.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BaseClass.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericInterface.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/Subclass.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/TestBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/WrappedSimpleBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/External.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/LogManager.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/Random.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletContextListenerImpl.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/WebBean.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User.java
   core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User2.java
   core/trunk/tests-arquillian/src/test/resources/
   core/trunk/tests-arquillian/src/test/resources/META-INF/
   core/trunk/tests-arquillian/src/test/resources/META-INF/services/
   core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
   core/trunk/tests-arquillian/src/test/resources/jndi.properties
   core/trunk/tests-arquillian/src/test/resources/org/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/nonContextual/
   core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/nonContextual/web.xml
Log:
WELD-493 Converted tests from core/tests to JUnit and Arquillian.



Property changes on: core/trunk/tests-arquillian
___________________________________________________________________
Name: svn:ignore
   + .classpath
.project
.settings
target



Added: core/trunk/tests-arquillian/pom.xml
===================================================================
--- core/trunk/tests-arquillian/pom.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/pom.xml	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,276 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <parent>
+      <artifactId>weld-core-parent</artifactId>
+      <groupId>org.jboss.weld</groupId>
+      <version>1.0.2-SNAPSHOT</version>
+      <relativePath>../parent/pom.xml</relativePath>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <groupId>org.jboss.weld</groupId>
+   <artifactId>weld-core-test-arquillian</artifactId>
+   <name>Weld Core Tests Arquillian</name>
+   <description>Tests for Weld, not including the CDI and AtInject TCKs</description>
+
+   <licenses>
+      <license>
+         <name>Apache License, Version 2.0</name>
+         <distribution>repo</distribution>
+         <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+      </license>
+   </licenses>
+   <url>http://www.seamframework.org/Weld</url>
+
+
+   <dependencies>
+
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>provided</scope> <!-- should be test, but we need junit for compiling AbstractClusterTest -->
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-junit</artifactId>
+         <scope>provided</scope><!-- should be test, but we need shrinkwrap-impl for compiling BeanArchive -->
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.spec.javax.servlet</groupId> 
+         <artifactId>jboss-servlet-api_3.0_spec</artifactId> 
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.metadata</groupId> 
+         <artifactId>jboss-metadata</artifactId> 
+      </dependency>
+
+      <dependency>
+      	<groupId>org.jboss</groupId>
+      	<artifactId>jboss-mdr</artifactId>
+      	<scope>test</scope>
+      </dependency>
+ 
+ 
+      <dependency>
+         <groupId>javax.el</groupId>
+         <artifactId>el-api</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.glassfish.web</groupId>
+         <artifactId>el-impl</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.servlet</groupId>
+         <artifactId>servlet-api</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.weld</groupId>
+         <artifactId>weld-core</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.weld</groupId>
+         <artifactId>weld-spi</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.spec.javax.interceptor</groupId>
+         <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.interceptor</groupId>
+         <artifactId>jboss-interceptor</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.ejb3</groupId>
+         <artifactId>jboss-ejb3-api</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>org.slf4j</groupId>
+         <artifactId>slf4j-simple</artifactId>
+         <scope>test</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.transaction</groupId>
+         <artifactId>jta</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.persistence</groupId>
+         <artifactId>persistence-api</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.validation</groupId>
+         <artifactId>validation-api</artifactId>
+      </dependency>
+
+      <dependency>
+         <groupId>javax.faces</groupId>
+         <artifactId>jsf-api</artifactId>
+         <!-- override for testing compatibility w/ JSF 2.0 -->
+         <version>2.0.2-FCS</version>
+      </dependency>
+
+      <dependency>
+         <groupId>net.sourceforge.htmlunit</groupId>
+         <artifactId>htmlunit</artifactId>
+      </dependency>
+
+   </dependencies>
+
+   <build>
+      <defaultGoal>test</defaultGoal>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-report-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>generate-test-report</id>
+                  <phase>test</phase>
+                  <goals>
+                     <goal>report-only</goal>
+                  </goals>
+               </execution>
+            </executions>
+            <configuration>
+               <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
+               <outputName>test-report</outputName>
+            </configuration>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+               <test>org.jboss.weld.tests.NormalSuite</test>
+               <!-- 
+               	Set parallel none to force a more modern JUnitCore provider that understands Suites, 
+               	http://old.nabble.com/Maven-Surefire-and-newer-junit-features-td28539796.html 
+               -->
+               <parallel>none</parallel>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <profiles>
+      <profile>
+         <id>defualt</id>
+         <activation>
+            <activeByDefault>true</activeByDefault>
+         </activation>
+         <dependencies>
+            <dependency>
+               <groupId>org.jboss.arquillian.container</groupId>
+               <artifactId>arquillian-weld-embedded</artifactId>
+               <scope>test</scope>
+            </dependency>
+      	</dependencies>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-surefire-plugin</artifactId>
+                  <configuration>
+                     <test>org.jboss.weld.tests.NormalSuite</test>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+      <profile>
+         <id>incontainer</id>
+         <activation>
+            <property>
+               <name>incontainer</name>
+            </property>
+         </activation>
+         <dependencies>
+            <dependency>
+               <groupId>org.jboss.arquillian.container</groupId>
+               <artifactId>arquillian-jbossas-remote-60</artifactId>
+               <scope>test</scope>
+            </dependency>
+            <dependency>
+               <groupId>org.jboss.jbossas</groupId>
+               <artifactId>jboss-as-client</artifactId>
+               <version>6.0.0.20100429-M3</version>
+               <type>pom</type>
+               <scope>test</scope>
+            </dependency>
+         </dependencies>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-surefire-plugin</artifactId>
+                  <configuration>
+                     <test>org.jboss.weld.tests.IntegrationSuite</test>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+<!-- 
+      <profile>
+         <id>write-artifacts-to-disk</id>
+         <activation>
+            <property>
+               <name>dumpArtifacts</name>
+            </property>
+         </activation>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>exec-maven-plugin</artifactId>
+                  <executions>
+                     <execution>
+                        <id>generate-test-artifacts</id>
+                        <phase>generate-test-sources</phase>
+                        <goals>
+                           <goal>java</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     <mainClass>org.jboss.testharness.api.TCK</mainClass>
+                     <classpathScope>test</classpathScope>
+                     <systemProperties>
+                        <systemProperty>
+                           <key>dumpArtifacts</key>
+                           <value>true</value>
+                        </systemProperty>
+                        <systemProperty>
+                           <key>org.jboss.testharness.outputDirectory</key>
+                           <value>target/test-artifacts</value>
+                        </systemProperty>
+                        <systemProperty>
+                           <key>org.jboss.testharness.libraryDirectory</key>
+                           <value>target/dependency/lib</value>
+                        </systemProperty>
+                     </systemProperties>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+-->
+   </profiles>
+
+   <scm> 
+      <connection>scm:svn:http://anonsvn.jboss.org/repos/weld/core/trunk/tests-arquillian</connection>
+      <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/core/trunk/tests-arquillian</developerConnection>
+      <url>http://fisheye.jboss.org/browse/weld/core/trunk/tests-arquillian</url>
+   </scm>
+
+</project>

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,39 @@
+package org.jboss.shrinkwrap.api;
+
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+public interface BeanArchive extends JavaArchive       
+{
+   
+   /**
+    * Adds Decorators to the beans.xml.
+    * @param classes
+    * @return
+    */
+   BeanArchive decorate(Class<?>... classes);
+   
+   /**
+    * Adds Interceptors to the beans.xml.
+    * 
+    * @param classes
+    * @return
+    */
+   BeanArchive intercept(Class<?>... classes);
+   
+   /**
+    * Adds Alternatives to the beans.xml.
+    * 
+    * @param classes
+    * @return
+    */
+   BeanArchive alternate(Class<?>... classes);
+   
+   /**
+    * Adds a Stereotype Alternative to beans.xml.
+    * 
+    * @param classes
+    * @return
+    */
+   BeanArchive stereotype(Class<?>... classes);
+}
+

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,137 @@
+package org.jboss.shrinkwrap.impl;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.impl.base.path.BasicPath;
+import org.jboss.shrinkwrap.impl.base.spec.JavaArchiveImpl;
+
+public class BeanArchiveImpl extends JavaArchiveImpl implements BeanArchive
+{
+   //-------------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+   
+   /**
+    * Path to the manifests inside of the Archive.
+    */
+   private static final ArchivePath PATH_MANIFEST = new BasicPath("META-INF");
+   
+   /**
+    * Path to the resources inside of the Archive.
+    */
+   private static final ArchivePath PATH_RESOURCE = new BasicPath("/");
+   
+   /**
+    * Path to the classes inside of the Archive.
+    */
+   private static final ArchivePath PATH_CLASSES = new BasicPath("/");
+   
+   /**
+    * Beans XML object
+    */
+   private BeansXml descriptor;
+
+   public BeanArchiveImpl(final Archive<?> delegate)
+   {
+      super(delegate);
+      
+      // add beans.xml descriptor
+      descriptor = new BeansXml();
+      addManifestResource(descriptor, ArchivePaths.create("beans.xml"));
+   }
+
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations -----------------------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+
+   /* (non-Javadoc)
+    * @see org.jboss.declarchive.impl.base.ContainerBase#getManinfestPath()
+    */
+   @Override
+   protected ArchivePath getManinfestPath()
+   {
+      return PATH_MANIFEST;
+   }
+   
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.shrinkwrap.impl.base.container.ContainerBase#getClassesPath()
+    */
+   @Override
+   protected ArchivePath getClassesPath()
+   {
+      return PATH_CLASSES;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.declarchive.impl.base.ContainerBase#getResourcePath()
+    */
+   @Override
+   protected ArchivePath getResourcePath()
+   {
+      return PATH_RESOURCE;
+   }
+   
+   /**
+    * Libraries are not supported by JavaArchive.
+    * 
+    * @throws UnsupportedOperationException Libraries are not supported by JavaArchive
+    */
+   @Override
+   public ArchivePath getLibraryPath()
+   {
+      throw new UnsupportedOperationException("JavaArchive spec does not support Libraries");
+   }
+   
+   //-------------------------------------------------------------------------------------||
+   // Required Implementations - BeanArchive ---------------------------------------------||
+   //-------------------------------------------------------------------------------------||
+   
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.api.BeanArchive#decorate(java.lang.Class<?>[])
+    */
+   public BeanArchive decorate(Class<?>... classes) 
+   {
+      descriptor.decorators(classes);
+      addClasses(classes);
+      return covarientReturn();
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.api.BeanArchive#intercept(java.lang.Class<?>[])
+    */
+   public BeanArchive intercept(Class<?>... classes) 
+   {
+      descriptor.interceptors(classes);
+      addClasses(classes);
+      return covarientReturn();
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.api.BeanArchive#alternate(java.lang.Class<?>[])
+    */
+   public BeanArchive alternate(Class<?>... classes) 
+   {
+      descriptor.alternatives(classes);
+      addClasses(classes);
+      return covarientReturn();
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.shrinkwrap.api.BeanArchive#stereotype(java.lang.Class<?>[])
+    */
+   public BeanArchive stereotype(Class<?>... classes) 
+   {
+      descriptor.stereotype(classes);
+      addClasses(classes);
+      return covarientReturn();
+   }
+   
+   @Override
+   protected BeanArchive covarientReturn()
+   {
+      return (BeanArchive)super.covarientReturn();
+   }
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,88 @@
+package org.jboss.shrinkwrap.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.shrinkwrap.api.Asset;
+
+class BeansXml implements Asset
+{
+  private List<Class<?>> alternatives = new ArrayList<Class<?>>();
+  private List<Class<?>> interceptors = new ArrayList<Class<?>>();
+  private List<Class<?>> decorators = new ArrayList<Class<?>>();
+  private List<Class<?>> stereotypes = new ArrayList<Class<?>>();
+  
+  BeansXml() {
+
+  }
+
+  public BeansXml alternatives(Class<?>... alternatives)
+  {
+     this.alternatives.addAll(Arrays.asList(alternatives));
+     return this;
+  }
+
+  public BeansXml interceptors(Class<?>... interceptors)
+  {
+     this.interceptors.addAll(Arrays.asList(interceptors));
+     return this;
+  }
+
+  public BeansXml decorators(Class<?>... decorators)
+  {
+     this.decorators.addAll(Arrays.asList(decorators));
+     return this;
+  }
+
+  public BeansXml stereotype(Class<?>... stereotypes)
+  {
+     this.stereotypes.addAll(Arrays.asList(stereotypes));
+     return this;
+  }
+  
+  public InputStream openStream()
+  {
+     StringBuilder xml = new StringBuilder();
+     xml.append("<beans>\n");
+     appendAlternatives(alternatives, stereotypes, xml);
+     appendSection("interceptors", "class", interceptors, xml);
+     appendSection("decorators", "class", decorators, xml);
+     xml.append("</beans>");
+
+     return new ByteArrayInputStream(xml.toString().getBytes());
+  }
+
+  private void appendAlternatives(List<Class<?>> alternatives, List<Class<?>> stereotypes, StringBuilder xml)
+  {
+     if(alternatives.size() > 0 || stereotypes.size() > 0)
+     {
+        xml.append("<").append("alternatives").append(">\n");
+        appendClasses("class", alternatives, xml);
+        appendClasses("stereotype", stereotypes, xml);
+        xml.append("</").append("alternatives").append(">\n");
+     }
+  }
+  
+  private void appendSection(String name, String subName, List<Class<?>> classes, StringBuilder xml)
+  {
+     if(classes.size() > 0)
+     {
+        xml.append("<").append(name).append(">\n");
+        appendClasses(subName, classes, xml);
+        xml.append("</").append(name).append(">\n");
+     }
+  }
+
+  private void appendClasses(String name, List<Class<?>> classes, StringBuilder xml)
+  {
+     for(Class<?> clazz : classes)
+     {
+        xml.append("<").append(name).append(">")
+              .append(clazz.getName())
+              .append("</").append(name).append(">\n");
+     }
+  }
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+
+public abstract class AbstractMockDeployment implements Deployment
+{
+
+   private final List<BeanDeploymentArchive> beanDeploymentArchives;
+   private final ServiceRegistry services;
+
+   public AbstractMockDeployment(BeanDeploymentArchive... beanDeploymentArchives)
+   {
+      this.services = new SimpleServiceRegistry();
+      this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>(Arrays.asList(beanDeploymentArchives));
+   }
+
+   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return beanDeploymentArchives;
+   }
+
+   public ServiceRegistry getServices()
+   {
+      return services;
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.EnterpriseBean;
+import javax.ejb.MessageDriven;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockBeanDeploymentArchive implements BeanDeploymentArchive
+{
+   
+
+   private Collection<Class<?>> beanClasses;
+   private Collection<URL> beansXmlFiles;
+   private List<EjbDescriptor<?>> ejbs;
+   private final ServiceRegistry services;
+   private final Collection<BeanDeploymentArchive> bdas;
+   private final String id;
+   
+   public MockBeanDeploymentArchive()
+   {
+      this("test");
+   }
+   
+   public MockBeanDeploymentArchive(String id, Class<?> ... classes)
+   {
+      this.services = new SimpleServiceRegistry();
+      this.beanClasses = Arrays.asList(classes);
+      this.beansXmlFiles = new HashSet<URL>();
+      this.bdas = new HashSet<BeanDeploymentArchive>();
+      this.id = id;
+   }
+
+   public Collection<Class<?>> getBeanClasses()
+   {
+      return beanClasses;
+   }
+   
+   public void setBeanClasses(Collection<Class<?>> beanClasses)
+   {
+      this.beanClasses = beanClasses;
+      ejbs = new ArrayList<EjbDescriptor<?>>();
+      for (Class<?> ejbClass : discoverEjbs(getBeanClasses()))
+      {
+         ejbs.add(MockEjbDescriptor.of(ejbClass));
+      }
+   }
+
+   public Collection<URL> getBeansXml()
+   {
+      return beansXmlFiles;
+   }
+   
+   public void setBeansXmlFiles(Collection<URL> beansXmlFiles)
+   {
+      this.beansXmlFiles = beansXmlFiles;
+   }
+
+   public Collection<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return bdas;
+   }
+   
+   public Collection<EjbDescriptor<?>> getEjbs()
+   {
+      return ejbs;
+   }
+   
+   protected static Iterable<Class<?>> discoverEjbs(Iterable<Class<?>> webBeanClasses)
+   {
+      Set<Class<?>> ejbs = new HashSet<Class<?>>();
+      for (Class<?> clazz : webBeanClasses)
+      {
+         if (clazz.isAnnotationPresent(Stateless.class) || clazz.isAnnotationPresent(Stateful.class) || clazz.isAnnotationPresent(MessageDriven.class) || clazz.isAnnotationPresent(Singleton.class) || EnterpriseBean.class.isAssignableFrom(clazz)) 
+         {
+            ejbs.add(clazz);
+         }
+      }
+      return ejbs;
+   }
+   
+   public ServiceRegistry getServices()
+   {
+      return services;
+   }
+   
+   public String getId()
+   {
+      return id;
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj instanceof MockBeanDeploymentArchive)
+      {
+         MockBeanDeploymentArchive that = (MockBeanDeploymentArchive) obj;
+         return this.getId().equals(that.getId());
+      }
+      else
+      {
+         return false;
+      }
+   }
+   
+   @Override
+   public int hashCode()
+   {
+      return getId().hashCode();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+
+public class MockDeployment extends AbstractMockDeployment
+{
+
+   private final BeanDeploymentArchive archive;
+
+   public MockDeployment(BeanDeploymentArchive beanDeploymentArchive)
+   {
+      this.archive = beanDeploymentArchive;
+      getBeanDeploymentArchives().add(archive);
+   }
+
+   public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+   {
+      return archive;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import org.jboss.weld.bootstrap.api.Environment;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.security.spi.SecurityServices;
+import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.validation.spi.ValidationServices;
+
+public class MockEELifecycle extends MockServletLifecycle
+{
+   
+   private static final TransactionServices MOCK_TRANSACTION_SERVICES = new MockTransactionServices();
+
+   public MockEELifecycle()
+   {
+      super();
+      getDeployment().getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
+      getDeployment().getServices().add(SecurityServices.class, new MockSecurityServices());
+      getDeployment().getServices().add(ValidationServices.class, new MockValidationServices());
+      getDeployment().getServices().add(EjbServices.class, new MockEjBServices());
+      getWar().getServices().add(EjbInjectionServices.class, new MockEjbInjectionServices());
+      getWar().getServices().add(JpaInjectionServices.class, new MockJpaServices(getDeployment()));
+      getWar().getServices().add(ResourceInjectionServices.class, new MockResourceServices());
+   }
+   
+   @Override
+   public Environment getEnvironment()
+   {
+      return Environments.EE_INJECT;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+
+public class MockEjBServices implements EjbServices
+{
+
+
+
+   public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor)
+   {
+      return new SessionObjectReference()
+      {
+
+         private static final long serialVersionUID = 1L;
+
+         public <S> S getBusinessObject(Class<S> businessInterfaceType)
+         {
+            // TODO Auto-generated method stub
+            return null;
+         }
+
+         public void remove()
+         {
+            // TODO Auto-generated method stub
+
+         }
+
+         public boolean isRemoved()
+         {
+            // TODO Auto-generated method stub
+            return false;
+         }
+
+      };
+   }
+
+   public void registerInterceptors(EjbDescriptor<?> ejbDescriptor, InterceptorBindings interceptorBindings)
+   {
+      // do nothing
+   }
+
+   public void cleanup() {}
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,201 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.ejb.MessageDriven;
+import javax.ejb.Remove;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+public class MockEjbDescriptor<T> implements EjbDescriptor<T>
+{
+   private final Class<T> beanClass;
+   private final String ejbName;
+   private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
+   private final HashSet<Method> removeMethods;
+   
+   public static <T> MockEjbDescriptor<T> of(Class<T> type)
+   {
+      return new MockEjbDescriptor<T>(type);
+   }
+
+   private MockEjbDescriptor(final Class<T> type)
+   {
+      this.beanClass = type;
+      this.ejbName = type.getSimpleName();
+      this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
+      
+      Local localAnnotation = type.getAnnotation(Local.class);
+      if (localAnnotation != null)
+      {
+         for (final Class<?> clazz : localAnnotation.value())
+         {
+            localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+         }
+      }
+      
+      for (final Class<?> clazz : type.getInterfaces())
+      {
+         if (clazz.isAnnotationPresent(Local.class))
+         {
+            localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+         }
+      }
+      // cope with EJB 3.1 style no-interface views
+      if (localInterfaces.size() == 0)
+      {
+         localInterfaces.add(createBusinessInterfaceDescriptor(type));
+      }
+      this.removeMethods = new HashSet<Method>();
+      for (final Method method : type.getMethods())
+      {
+         if (method.isAnnotationPresent(Remove.class))
+         {
+            removeMethods.add(method);
+         }
+      }
+   }
+
+   private BusinessInterfaceDescriptor<Object> createBusinessInterfaceDescriptor(final Class<?> clazz)
+   {
+      return new BusinessInterfaceDescriptor<Object>()
+      {
+  
+         @SuppressWarnings("unchecked")
+         public Class<Object> getInterface()
+         {
+            return (Class<Object>) clazz;
+         }
+  
+         public String getJndiName()
+         {
+            return clazz.getSimpleName() + "/local";
+         }
+      
+      };
+   }
+
+   public String getEjbName()
+   {
+      return ejbName;
+   }
+
+   public Collection<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
+   {
+      return localInterfaces;
+   }
+   
+   public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
+   {
+      return Collections.emptyList();
+   }
+
+   public Collection<Method> getRemoveMethods()
+   {
+
+      return removeMethods;
+   }
+
+   public Class<T> getBeanClass()
+   {
+      return beanClass;
+   }
+
+   public boolean isMessageDriven()
+   {
+      return beanClass.isAnnotationPresent(MessageDriven.class);
+   }
+
+   public boolean isSingleton()
+   {
+      return beanClass.isAnnotationPresent(Singleton.class);
+   }
+
+   public boolean isStateful()
+   {
+      return beanClass.isAnnotationPresent(Stateful.class);
+   }
+
+   public boolean isStateless()
+   {
+      return beanClass.isAnnotationPresent(Stateless.class);
+   }
+   
+   public String getLocalJndiName()
+   {
+      return beanClass.getSimpleName() + "/local";
+   }
+   
+   @Override
+   public String toString()
+   {
+      StringBuilder builder = new StringBuilder();
+      builder.append(getEjbName());
+      if (isStateful())
+      {
+         builder.append(" (SFSB)");
+      }
+      if (isStateless())
+      {
+         builder.append(" (SLSB)");
+      }
+      if (isSingleton())
+      {
+         builder.append(" (Singleton)");
+      }
+      if (isMessageDriven())
+      {
+         builder.append(" (MDB)");
+      }
+      builder.append("remove methods; " + removeMethods + "; ");
+      builder.append("; BeanClass: " + getBeanClass() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
+      return builder.toString(); 
+   }
+   
+//   @Override
+//   public boolean equals(Object other)
+//   {
+//      if (other instanceof EjbDescriptor)
+//      {
+//         EjbDescriptor<T> that = (EjbDescriptor<T>) other;
+//         return this.getBeanClass().equals(that.getBeanClass());
+//      }
+//      else
+//      {
+//         return false;
+//      }
+//   }
+//   
+//   @Override
+//   public int hashCode()
+//   {
+//      return getEjbName().hashCode();
+//   }
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockEjbInjectionServices implements EjbInjectionServices
+{
+
+   public Object resolveEjb(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+   
+   public void cleanup() {}
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+/**
+ * A mock implementation of the HttpSession interface for tests.
+ * 
+ * @author Dan Allen
+ */
+public class MockHttpSession implements HttpSession
+{
+   private String id;
+   
+   private ServletContext servletContext;
+   
+   private Map<String, Object> attributes = new HashMap<String, Object>();
+
+   private boolean invalid = false;
+   
+   private int maxInactiveInterval = 60;
+   
+   private int lastAccessedTime = -1;
+   
+   public MockHttpSession() {}
+   
+   public MockHttpSession(String id)
+   {
+      this.id = id;
+   }
+   
+   public MockHttpSession(String id, ServletContext servletContext)
+   {
+      this(id);
+      this.servletContext = servletContext;
+   }
+
+   public Object getAttribute(String name)
+   {
+      return attributes.get(name);
+   }
+
+   public Enumeration<String> getAttributeNames()
+   {
+      final Iterator<String> nameIterator = attributes.keySet().iterator();
+      return new Enumeration<String>()
+      {
+
+         public boolean hasMoreElements()
+         {
+            return nameIterator.hasNext();
+         }
+
+         public String nextElement()
+         {
+            return nameIterator.next();
+         }
+      };
+   }
+
+   public long getCreationTime()
+   {
+      return 0;
+   }
+
+   public String getId()
+   {
+      return id;
+   }
+
+   public long getLastAccessedTime()
+   {
+      return lastAccessedTime;
+   }
+
+   public int getMaxInactiveInterval()
+   {
+      return maxInactiveInterval;
+   }
+
+   public ServletContext getServletContext()
+   {
+      return servletContext;
+   }
+
+   @SuppressWarnings("deprecation")
+   public HttpSessionContext getSessionContext()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public Object getValue(String name)
+   {
+      return getAttribute(name);
+   }
+
+   public String[] getValueNames()
+   {
+      return attributes.keySet().toArray(new String[0]);
+   }
+
+   public void invalidate()
+   {
+      attributes.clear();
+      invalid = true;
+   }
+
+   public boolean isNew()
+   {
+      return false;
+   }
+
+   public void putValue(String name, Object value)
+   {
+      setAttribute(name, value);
+   }
+
+   public void removeAttribute(String name)
+   {
+      attributes.remove(name);
+   }
+
+   public void removeValue(String name)
+   {
+      removeAttribute(name);
+   }
+
+   public void setAttribute(String name, Object value)
+   {
+      if (value == null)
+      {
+         removeAttribute(name);
+      }
+      else
+      {
+         attributes.put(name, value);
+      }
+   }
+
+   public void setMaxInactiveInterval(int seconds)
+   {
+      maxInactiveInterval = seconds;
+   }
+   
+   public boolean isInvalid()
+   {
+      return invalid;
+   }
+   
+   public void access()
+   {
+      lastAccessedTime = (int) System.currentTimeMillis();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.persistence.Entity;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+
+public class MockJpaServices implements JpaInjectionServices
+{
+   
+   private final Deployment deployment;
+   
+   public MockJpaServices(Deployment deployment)
+   {
+      this.deployment = deployment;
+   }
+   
+   public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+   
+   public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+   
+   public Collection<Class<?>> discoverEntities()
+   {
+      Set<Class<?>> classes = new HashSet<Class<?>>();
+      for (BeanDeploymentArchive archive : deployment.getBeanDeploymentArchives())
+      {
+         discoverEntities(archive, classes);
+      }
+      return classes;
+   }
+   
+   private void discoverEntities(BeanDeploymentArchive archive, Set<Class<?>> classes)
+   {
+      for (Class<?> clazz : archive.getBeanClasses())
+      {
+         if (clazz.isAnnotationPresent(Entity.class))
+         {
+            classes.add(clazz);
+         }
+      }
+      for (BeanDeploymentArchive child : archive.getBeanDeploymentArchives())
+      {
+         discoverEntities(child, classes);
+      }
+   }
+   
+   public void cleanup() {}
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import org.jboss.weld.bootstrap.api.Lifecycle;
+
+public interface MockLifecycle extends Lifecycle
+{
+
+   public abstract void initialize();
+
+   public abstract void beginApplication();
+
+   public abstract void endApplication();
+
+   public abstract void resetContexts();
+
+   public abstract void beginRequest();
+
+   public abstract void endRequest();
+
+   public abstract void beginSession();
+
+   public abstract void endSession();
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoadingException;
+import org.jboss.weld.util.collections.EnumerationList;
+
+public class MockResourceLoader implements ResourceLoader
+{
+   
+   public Class<?> classForName(String name)
+   {
+      try
+      {
+         return Thread.currentThread().getContextClassLoader().loadClass(name);
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new ResourceLoadingException(e);
+      }
+   }
+   
+   public URL getResource(String name)
+   {
+      return Thread.currentThread().getContextClassLoader().getResource(name);
+   }
+   
+   public Collection<URL> getResources(String name)
+   {
+      try
+      {
+         return new EnumerationList<URL>(Thread.currentThread().getContextClassLoader().getResources(name));
+      }
+      catch (IOException e)
+      {
+         throw new ResourceLoadingException(e);
+      }
+   }
+   
+   public void cleanup() {}
+   
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class MockResourceServices implements ResourceInjectionServices
+{
+
+   public Object resolveResource(InjectionPoint injectionPoint)
+   {
+      return null;
+   }
+   
+   public Object resolveResource(String jndiName, String mappedName)
+   {
+      return null;
+   }
+   
+   public void cleanup() {}
+   
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import java.security.Principal;
+
+import org.jboss.weld.security.spi.SecurityServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockSecurityServices implements SecurityServices
+{
+
+   public Principal getPrincipal()
+   {
+      return new Principal()
+      {
+         
+         public String getName()
+         {
+            return null;
+         }
+      };
+   }
+   
+   public void cleanup() {}
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,704 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.FilterRegistration.Dynamic;
+import javax.servlet.descriptor.JspConfigDescriptor;
+
+/**
+ * Mock implementation of the servlet context for testing purposes. This implementation supports all
+ * of the standard context methods except that request dispatching just indicates what is being
+ * dispatched to, rather than doing the actual dispatch.
+ * <p>
+ * The context can be configured with a path parameter that should point to an absolute directory
+ * location that represents the place where the contents of the WAR bundle are located. Setting this
+ * value allows all of the resource location functionality to work as in a fully functioning web
+ * application. This value is not set then not resource location functionality will work and instead
+ * null will always be returned.
+ *
+ * Adapted from Apache Wicket
+ * 
+ * @author Chris Turner (Wicket)
+ */
+public class MockServletContext implements ServletContext
+{
+	private final Map<String, Object> attributes = new HashMap<String, Object>();
+
+	private final Map<String, String> initParameters = new HashMap<String, String>();
+
+	/** Map of mime types */
+	private final Map<String, String> mimeTypes = new HashMap<String, String>();
+
+	private File webappRoot;
+
+	/**
+	 * Create the mock object. As part of the creation, the context sets the root directory where
+	 * web application content is stored. This must be an ABSOLUTE directory relative to where the
+	 * tests are being executed. For example: <code>System.getProperty("user.dir") +
+	 * "/src/webapp"</code>
+	 * 
+	 * @param application
+	 *            The application that this context is for
+	 * @param path
+	 *            The path to the root of the web application
+	 */
+	public MockServletContext(final String path)
+	{
+		webappRoot = null;
+		if (path != null)
+		{
+			webappRoot = new File(path);
+			if (!webappRoot.exists() || !webappRoot.isDirectory())
+			{
+				//log.warn("WARNING: The webapp root directory is invalid: " + path);
+				webappRoot = null;
+			}
+		}
+
+		// assume we're running in maven or an eclipse project created by maven,
+		// so the sessions directory will be created inside the target directory,
+		// and will be cleaned up with a mvn clean
+
+		File file = new File("target/work/");
+		file.mkdirs();
+		attributes.put("javax.servlet.context.tempdir", file);
+
+		mimeTypes.put("html", "text/html");
+		mimeTypes.put("htm", "text/html");
+		mimeTypes.put("css", "text/css");
+		mimeTypes.put("xml", "text/xml");
+		mimeTypes.put("js", "text/plain");
+		mimeTypes.put("gif", "image/gif");
+		mimeTypes.put("jpg", "image/jpeg");
+		mimeTypes.put("png", "image/png");
+	}
+
+	/**
+	 * Add an init parameter.
+	 * 
+	 * @param name
+	 *            The parameter name
+	 * @param value
+	 *            The parameter value
+	 */
+	public void addInitParameter(final String name, final String value)
+	{
+		initParameters.put(name, value);
+	}
+
+	// Configuration methods
+
+	/**
+	 * Add a new recognized mime type.
+	 * 
+	 * @param fileExtension
+	 *            The file extension (e.g. "jpg")
+	 * @param mimeType
+	 *            The mime type (e.g. "image/jpeg")
+	 */
+	public void addMimeType(final String fileExtension, final String mimeType)
+	{
+		mimeTypes.put(fileExtension, mimeType);
+	}
+
+	/**
+	 * Get an attribute with the given name.
+	 * 
+	 * @param name
+	 *            The attribute name
+	 * @return The value, or null
+	 */
+	public Object getAttribute(final String name)
+	{
+		return attributes.get(name);
+	}
+
+	/**
+	 * Get all of the attribute names.
+	 * 
+	 * @return The attribute names
+	 */
+	public Enumeration<String> getAttributeNames()
+	{
+		return Collections.enumeration(attributes.keySet());
+	}
+
+	// ServletContext interface methods
+
+	/**
+	 * Get the context for the given URL path
+	 * 
+	 * @param name
+	 *            The url path
+	 * @return Always returns this
+	 */
+	public ServletContext getContext(String name)
+	{
+		return this;
+	}
+
+	/**
+	 * Get the init parameter with the given name.
+	 * 
+	 * @param name
+	 *            The name
+	 * @return The parameter, or null if no such parameter
+	 */
+	public String getInitParameter(final String name)
+	{
+		return initParameters.get(name);
+	}
+
+	/**
+	 * Get the name of all of the init parameters.
+	 * 
+	 * @return The init parameter names
+	 */
+	public Enumeration<String> getInitParameterNames()
+	{
+		return Collections.enumeration(initParameters.keySet());
+	}
+
+	/**
+	 * @return Always 2
+	 */
+	public int getMajorVersion()
+	{
+		return 2;
+	}
+
+	/**
+	 * Get the mime type for the given file. Uses a hardcoded map of mime types set at
+	 * Initialization time.
+	 * 
+	 * @param name
+	 *            The name to get the mime type for
+	 * @return The mime type
+	 */
+	public String getMimeType(final String name)
+	{
+		int index = name.lastIndexOf('.');
+		if (index == -1 || index == (name.length() - 1))
+		{
+			return null;
+		}
+		else
+		{
+			return mimeTypes.get(name.substring(index + 1));
+		}
+	}
+
+	/**
+	 * @return Always 3
+	 */
+	public int getMinorVersion()
+	{
+		return 3;
+	}
+
+	/**
+	 * Wicket does not use the RequestDispatcher, so this implementation just returns a dummy value.
+	 * 
+	 * @param name
+	 *            The name of the servlet or JSP
+	 * @return The dispatcher
+	 */
+	public RequestDispatcher getNamedDispatcher(final String name)
+	{
+		return getRequestDispatcher(name);
+	}
+
+	/**
+	 * Get the real file path of the given resource name.
+	 * 
+	 * @param name
+	 *            The name
+	 * @return The real path or null
+	 */
+	public String getRealPath(String name)
+	{
+		if (webappRoot == null)
+		{
+			return null;
+		}
+
+		if (name.startsWith("/"))
+		{
+			name = name.substring(1);
+		}
+
+		File f = new File(webappRoot, name);
+		if (!f.exists())
+		{
+			return null;
+		}
+		else
+		{
+			return f.getPath();
+		}
+	}
+
+	/**
+	 * Wicket does not use the RequestDispatcher, so this implementation just returns a dummy value.
+	 * 
+	 * @param name
+	 *            The name of the resource to get the dispatcher for
+	 * @return The dispatcher
+	 */
+	public RequestDispatcher getRequestDispatcher(final String name)
+	{
+		return new RequestDispatcher()
+		{
+			public void forward(ServletRequest servletRequest, ServletResponse servletResponse)
+				throws IOException
+			{
+				servletResponse.getWriter().write("FORWARD TO RESOURCE: " + name);
+			}
+
+			public void include(ServletRequest servletRequest, ServletResponse servletResponse)
+				throws IOException
+			{
+				servletResponse.getWriter().write("INCLUDE OF RESOURCE: " + name);
+			}
+		};
+	}
+
+	/**
+	 * Get the URL for a particular resource that is relative to the web app root directory.
+	 * 
+	 * @param name
+	 *            The name of the resource to get
+	 * @return The resource, or null if resource not found
+	 * @throws MalformedURLException
+	 *             If the URL is invalid
+	 */
+	public URL getResource(String name) throws MalformedURLException
+	{
+		if (webappRoot == null)
+		{
+			return null;
+		}
+
+		if (name.startsWith("/"))
+		{
+			name = name.substring(1);
+		}
+
+		File f = new File(webappRoot, name);
+		if (!f.exists())
+		{
+			return null;
+		}
+		else
+		{
+			return f.toURI().toURL();
+		}
+	}
+
+	/**
+	 * Get an input stream for a particular resource that is relative to the web app root directory.
+	 * 
+	 * @param name
+	 *            The name of the resource to get
+	 * @return The input stream for the resource, or null of resource is not found
+	 */
+	public InputStream getResourceAsStream(String name)
+	{
+		if (webappRoot == null)
+		{
+			return null;
+		}
+
+		if (name.startsWith("/"))
+		{
+			name = name.substring(1);
+		}
+
+		File f = new File(webappRoot, name);
+		if (!f.exists())
+		{
+			return null;
+		}
+		else
+		{
+			try
+			{
+				return new FileInputStream(f);
+			}
+			catch (FileNotFoundException e)
+			{
+				e.printStackTrace();
+				return null;
+			}
+		}
+	}
+
+	/**
+	 * Get the resource paths starting from the web app root directory and then relative to the the
+	 * given name.
+	 * 
+	 * @param name
+	 *            The starting name
+	 * @return The set of resource paths at this location
+	 */
+	public Set<String> getResourcePaths(String name)
+	{
+		if (webappRoot == null)
+		{
+			return new HashSet<String>();
+		}
+
+		if (name.startsWith("/"))
+		{
+			name = name.substring(1);
+		}
+		if (name.endsWith("/"))
+		{
+			name = name.substring(0, name.length() - 1);
+		}
+		String[] elements = null;
+		if (name.trim().length() == 0)
+		{
+			elements = new String[0];
+		}
+		else
+		{
+			elements = name.split("/");
+		}
+
+		File current = webappRoot;
+		for (int i = 0; i < elements.length; i++)
+		{
+			File[] files = current.listFiles();
+			boolean match = false;
+			for (int f = 0; f < files.length; f++)
+			{
+				if (files[f].getName().equals(elements[i]) && files[f].isDirectory())
+				{
+					current = files[f];
+					match = true;
+					break;
+				}
+			}
+			if (!match)
+			{
+				return null;
+			}
+		}
+
+		File[] files = current.listFiles();
+		Set<String> result = new HashSet<String>();
+		int stripLength = webappRoot.getPath().length();
+		for (int f = 0; f < files.length; f++)
+		{
+			String s = files[f].getPath().substring(stripLength).replace('\\', '/');
+			if (files[f].isDirectory())
+			{
+				s = s + "/";
+			}
+			result.add(s);
+		}
+		return result;
+	}
+
+	/**
+	 * Get the server info.
+	 * 
+	 * @return The server info
+	 */
+	public String getServerInfo()
+	{
+		return "Wicket Mock Test Environment v1.0";
+	}
+
+	/**
+	 * NOT USED - Servlet Spec requires that this always returns null.
+	 * 
+	 * @param name
+	 *            Not used
+	 * @return null
+	 * @throws ServletException
+	 *             Not used
+	 */
+	public Servlet getServlet(String name) throws ServletException
+	{
+		return null;
+	}
+
+	/**
+	 * Return the name of the servlet context.
+	 * 
+	 * @return The name
+	 */
+	public String getServletContextName()
+	{
+		return "Mock";
+	}
+
+	/**
+	 * NOT USED - Servlet spec requires that this always returns null.
+	 * 
+	 * @return null
+	 */
+	public Enumeration<String> getServletNames()
+	{
+		return null;
+	}
+
+	/**
+	 * NOT USED - Servlet spec requires that this always returns null.
+	 * 
+	 * @return null
+	 */
+	public Enumeration<Servlet> getServlets()
+	{
+		return null;
+	}
+
+	/**
+	 * As part of testing we always log to the console.
+	 * 
+	 * @param e
+	 *            The exception to log
+	 * @param msg
+	 *            The message to log
+	 */
+	public void log(Exception e, String msg)
+	{
+		//log.error(msg, e);
+	}
+
+	/**
+	 * As part of testing we always log to the console.
+	 * 
+	 * @param msg
+	 *            The message to log
+	 */
+	public void log(String msg)
+	{
+		//log.info(msg);
+	}
+
+	/**
+	 * As part of testing we always log to the console.
+	 * 
+	 * @param msg
+	 *            The message to log
+	 * @param cause
+	 *            The cause exception
+	 */
+	public void log(String msg, Throwable cause)
+	{
+		//log.error(msg, cause);
+	}
+
+	/**
+	 * Remove an attribute with the given name.
+	 * 
+	 * @param name
+	 *            The name
+	 */
+	public void removeAttribute(final String name)
+	{
+		attributes.remove(name);
+	}
+
+	/**
+	 * Set an attribute.
+	 * 
+	 * @param name
+	 *            The name of the attribute
+	 * @param o
+	 *            The value
+	 */
+	public void setAttribute(final String name, final Object o)
+	{
+		attributes.put(name, o);
+	}
+
+	/**
+	 * @return context path
+	 */
+	public String getContextPath()
+	{
+		return "";
+	}
+
+	public Dynamic addFilter(String arg0, String arg1) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Dynamic addFilter(String arg0, Filter arg1) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Dynamic addFilter(String arg0, Class<? extends Filter> arg1) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void addListener(String arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public <T extends EventListener> void addListener(T arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void addListener(Class<? extends EventListener> arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+			String arg1) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+			Servlet arg1) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+			Class<? extends Servlet> arg1) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public <T extends Filter> T createFilter(Class<T> arg0)
+			throws ServletException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public <T extends EventListener> T createListener(Class<T> arg0)
+			throws ServletException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public <T extends Servlet> T createServlet(Class<T> arg0)
+			throws ServletException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void declareRoles(String... arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public ClassLoader getClassLoader() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public int getEffectiveMajorVersion() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public int getEffectiveMinorVersion() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FilterRegistration getFilterRegistration(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public JspConfigDescriptor getJspConfigDescriptor() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public ServletRegistration getServletRegistration(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public SessionCookieConfig getSessionCookieConfig() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public boolean setInitParameter(String arg0, String arg1) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void setSessionTrackingModes(Set<SessionTrackingMode> arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+	
+	
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,183 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import org.jboss.weld.bootstrap.WeldBootstrap;
+import org.jboss.weld.bootstrap.api.Environment;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.bootstrap.api.Lifecycle;
+import org.jboss.weld.bootstrap.api.helpers.ForwardingLifecycle;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.servlet.api.ServletServices;
+
+public class MockServletLifecycle extends ForwardingLifecycle implements MockLifecycle
+{
+   private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
+   
+   private final WeldBootstrap bootstrap;
+   private final Deployment deployment;
+   private final MockBeanDeploymentArchive war;
+   private final BeanStore applicationBeanStore;
+   private final BeanStore sessionBeanStore;
+   private final BeanStore requestBeanStore;
+   
+   private Lifecycle lifecycle;
+   
+   public MockServletLifecycle()
+   {
+      this(new MockBeanDeploymentArchive());
+   }
+   
+   private MockServletLifecycle(MockBeanDeploymentArchive war)
+   {
+      this(new MockDeployment(war), war);
+   }
+   
+   public MockServletLifecycle(Deployment deployment, MockBeanDeploymentArchive war)
+   {
+      this.deployment = deployment;
+      this.war = war;
+      if (deployment == null)
+      {
+         throw new IllegalStateException("No WebBeanDiscovery is available");
+      }
+      this.bootstrap = new WeldBootstrap();
+      this.deployment.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
+      this.deployment.getServices().add(ServletServices.class, new MockServletServices(war));
+      this.applicationBeanStore = new ConcurrentHashMapBeanStore();
+      this.sessionBeanStore = new ConcurrentHashMapBeanStore();
+      this.requestBeanStore = new ConcurrentHashMapBeanStore();
+   }
+   
+   protected BeanStore getSessionBeanStore()
+   {
+      return sessionBeanStore;
+   }
+   
+   protected BeanStore getRequestBeanStore()
+   {
+      return requestBeanStore;
+   }
+   
+   protected BeanStore getApplicationBeanStore()
+   {
+      return applicationBeanStore;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#initialize()
+    */
+   public void initialize()
+   {
+      try
+      {
+         bootstrap.startContainer(getEnvironment(), getDeployment(), getApplicationBeanStore());
+      }
+      finally  
+      {
+         lifecycle = deployment.getServices().get(ContextLifecycle.class);
+      }
+   }
+   
+   @Override
+   protected Lifecycle delegate()
+   {
+      return lifecycle;
+   }
+   
+   protected Deployment getDeployment()
+   {
+      return deployment;
+   }
+   
+   public WeldBootstrap getBootstrap()
+   {
+      return bootstrap;
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#beginApplication()
+    */
+   public void beginApplication()
+   {
+      bootstrap.startInitialization().deployBeans().validateBeans().endInitialization();
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#endApplication()
+    */
+   @Override
+   public void endApplication()
+   {
+      bootstrap.shutdown();
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#resetContexts()
+    */
+   public void resetContexts()
+   {
+      
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#beginRequest()
+    */
+   public void beginRequest()
+   {
+      super.beginRequest("Mock", getRequestBeanStore());
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#endRequest()
+    */
+   public void endRequest()
+   {
+      super.endRequest("Mock", getRequestBeanStore());
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#beginSession()
+    */
+   public void beginSession()
+   {
+      super.restoreSession("Mock", getSessionBeanStore());
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.weld.mock.MockLifecycle#endSession()
+    */
+   public void endSession()
+   {
+      // TODO Conversation handling breaks this :-(
+      //super.endSession("Mock", sessionBeanStore);
+   }
+   
+   protected Environment getEnvironment()
+   {
+      return Environments.SERVLET;
+   }
+   
+   public MockBeanDeploymentArchive getWar()
+   {
+      return war;
+   }
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.servlet.api.ServletServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockServletServices implements ServletServices
+{
+
+   private final BeanDeploymentArchive beanDeploymentArchive;
+   
+   public MockServletServices(BeanDeploymentArchive beanDeploymentArchive)
+   {
+      this.beanDeploymentArchive = beanDeploymentArchive;
+   }
+
+   public BeanDeploymentArchive getBeanDeploymentArchive(ServletContext ctx)
+   {
+      if (ctx instanceof MockServletContext)
+      {
+         return beanDeploymentArchive;
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   public void cleanup() {}
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import org.jboss.weld.transaction.spi.TransactionServices;
+
+/**
+ * A mock version of TransactionServices for RI unit tests.  Since
+ * no JTA transaction can be active for these unit tests, all
+ * methods here are empty.
+ * 
+ * @author David Allen
+ *
+ */
+public class MockTransactionServices implements TransactionServices
+{
+
+   public boolean isTransactionActive()
+   {
+      return false;
+   }
+
+   public void registerSynchronization(Synchronization synchronizedObserver)
+   {
+   }
+   
+   public UserTransaction getUserTransaction()
+   {
+      return new UserTransaction()
+      {
+         
+         public void setTransactionTimeout(int arg0) throws SystemException
+         {
+            
+         }
+         
+         public void setRollbackOnly() throws IllegalStateException, SystemException
+         {
+            
+         }
+         
+         public void rollback() throws IllegalStateException, SecurityException, SystemException
+         {
+           
+         }
+         
+         public int getStatus() throws SystemException
+         {
+            return 0;
+         }
+         
+         public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
+         {
+            
+         }
+         
+         public void begin() throws NotSupportedException, SystemException
+         {
+            
+         }
+      };
+   }
+   
+   public void cleanup() {}
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import javax.validation.ConstraintValidatorFactory;
+import javax.validation.MessageInterpolator;
+import javax.validation.TraversableResolver;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorContext;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.weld.validation.spi.ValidationServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockValidationServices implements ValidationServices
+{
+
+   public ValidatorFactory getDefaultValidatorFactory()
+   {
+      return new ValidatorFactory()
+      {
+         
+         public ValidatorContext usingContext()
+         {
+            // TODO Auto-generated method stub
+            return null;
+         }
+         
+         public <T> T unwrap(Class<T> type)
+         {
+            if (type.equals(ValidatorFactory.class))
+            {
+               return type.cast(this);
+            }
+            else
+            {
+               throw new ValidationException();
+            }
+         }
+         
+         public Validator getValidator()
+         {
+            return new MockValidator();
+         }
+         
+         public TraversableResolver getTraversableResolver()
+         {
+            // TODO Auto-generated method stub
+            return null;
+         }
+         
+         public MessageInterpolator getMessageInterpolator()
+         {
+            // TODO Auto-generated method stub
+            return null;
+         }
+         
+         public ConstraintValidatorFactory getConstraintValidatorFactory()
+         {
+            // TODO Auto-generated method stub
+            return null;
+         }
+      };
+   }
+   
+   public void cleanup() {}
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.metadata.BeanDescriptor;
+
+public class MockValidator implements Validator
+{
+
+   public BeanDescriptor getConstraintsForClass(Class<?> clazz)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public <T> T unwrap(Class<T> type)
+   {
+      if (type.equals(Validator.class))
+      {
+         return type.cast(this);
+      }
+      else
+      {
+         throw new ValidationException();
+      }
+   }
+
+   public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.manager.BeanManagerImpl;
+
+/**
+ * Control of the container, used for tests. Wraps up common operations.
+ * 
+ * If you require more control over the container bootstrap lifecycle you should
+ * use the {@link #getLifecycle()} method. For example:
+ * 
+ * <code>TestContainer container = new TestContainer(...);
+ * container.getLifecycle().initialize();
+ * container.getLifecycle().getBootstrap().startInitialization();
+ * container.getLifecycle().getBootstrap().deployBeans();
+ * container.getLifecycle().getBootstrap().validateBeans();
+ * container.getLifecycle().getBootstrap().endInitialization();
+ * container.getLifecycle().stopContainer();</code>
+ * 
+ * Note that we can easily mix fine-grained calls to bootstrap, and coarse grained calls to {@link TestContainer}.
+ * 
+ * @author pmuir
+ *
+ */
+public class TestContainer
+{
+   
+   private final MockServletLifecycle lifecycle;
+   
+   /**
+    * Create a container, specifying the classes and beans.xml to deploy
+    * 
+    * @param lifecycle
+    * @param classes
+    * @param beansXml
+    */
+   public TestContainer(MockServletLifecycle lifecycle, Collection<Class<?>> classes, Collection<URL> beansXml)
+   {
+      this(lifecycle);
+      configureArchive(classes, beansXml);
+   }
+   
+   public TestContainer(MockServletLifecycle lifecycle)
+   {
+      this.lifecycle = lifecycle;
+   }
+   
+   public TestContainer(MockServletLifecycle lifecycle, Class<?>[] classes, URL[] beansXml)
+   {
+      this(lifecycle, classes == null ? null : Arrays.asList(classes), beansXml == null ? null : Arrays.asList(beansXml));
+   }
+   
+   public TestContainer(MockServletLifecycle lifecycle, Class<?>... classes)
+   {
+      this(lifecycle, classes == null ? null : Arrays.asList(classes), null);
+   }
+   
+   /**
+    * Starts the container and begins the application
+    */
+   public TestContainer startContainer()
+   {
+      getLifecycle().initialize();
+      getLifecycle().beginApplication();
+      return this;
+   }
+   
+   /**
+    * Configure's the archive with the classes and beans.xml
+    */
+   protected TestContainer configureArchive(Collection<Class<?>> classes, Collection<URL> beansXml)
+   {
+      MockBeanDeploymentArchive archive = lifecycle.getWar();
+      archive.setBeanClasses(classes);
+      if (beansXml != null)
+      {
+         archive.setBeansXmlFiles(beansXml);
+      }
+      return this;
+   }
+   
+   /**
+    * Get the context lifecycle, allowing fine control over the contexts' state
+    * 
+    * @return
+    */
+   public MockServletLifecycle getLifecycle()
+   {
+      return lifecycle;
+   }
+   
+   public BeanManagerImpl getBeanManager()
+   {
+      return getLifecycle().getBootstrap().getManager(getLifecycle().getWar());
+   }
+   
+   public Deployment getDeployment()
+   {
+      return getLifecycle().getDeployment();
+   }
+   
+   /**
+    * Utility method which ensures a request is active and available for use
+    * 
+    */
+   public TestContainer ensureRequestActive()
+   {
+      if (!getLifecycle().isSessionActive())
+      {
+         getLifecycle().beginSession();
+      }
+      if (!getLifecycle().isConversationActive())
+      {
+         ((ConversationContext) getLifecycle().getConversationContext()).setActive(true);
+      }
+      if (!getLifecycle().isRequestActive())
+      {
+         getLifecycle().beginRequest();
+      }
+      return this;
+   }
+
+   /**
+    * Clean up the container, ending any active contexts
+    * 
+    */
+   public TestContainer stopContainer()
+   {
+      if (getLifecycle().isRequestActive())
+      {
+         getLifecycle().endRequest();
+      }
+      if (getLifecycle().isConversationActive())
+      {
+         ((ConversationContext) getLifecycle().getConversationContext()).setActive(false);
+      }
+      if (getLifecycle().isSessionActive())
+      {
+         getLifecycle().endSession();
+      }
+      if (getLifecycle().isApplicationActive())
+      {
+         getLifecycle().endApplication();
+      }
+      return this;
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock.cluster;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.bootstrap.api.Singleton;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.ContextualInstance;
+import org.jboss.weld.context.beanstore.HashMapBeanStore;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.serialization.spi.ProxyServices;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class AbstractClusterTest
+{
+
+   private Singleton<Container> singleton;
+
+   @SuppressWarnings("unchecked")
+   @BeforeClass
+   public void beforeClass() throws Exception
+   {
+      singleton = (Singleton) getInstanceField().get(null);
+      getInstanceField().set(null, new SwitchableSingletonProvider().create(Container.class));
+   }
+
+   private static Field getInstanceField() throws Exception
+   {
+      Field field = Container.class.getDeclaredField("instance");
+      field.setAccessible(true);
+      return field;
+   }
+
+   @AfterClass
+   public void afterClass() throws Exception
+   {
+      getInstanceField().set(null, singleton);
+   }
+
+   protected TestContainer bootstrapContainer(int id, Collection<Class<?>> classes)
+   {
+      // Bootstrap container
+      SwitchableSingletonProvider.use(id);
+
+      TestContainer container = new TestContainer(new SwitchableMockEELifecycle(), classes, null);
+      container.startContainer();
+      container.ensureRequestActive();
+
+      return container;
+   }
+
+   protected void use(int id)
+   {
+      SwitchableSingletonProvider.use(id);
+   }
+
+   private Map<String, ContextualInstance<?>> getContextualInstances(BeanStore beanStore)
+   {
+      Map<String, ContextualInstance<?>> instances = new HashMap<String, ContextualInstance<?>>();
+      for (String id : beanStore.getContextualIds())
+      {
+         instances.put(id, beanStore.get(id));
+      }
+      return instances;
+   }
+
+   private BeanStore setContextualInstances(Map<String, ContextualInstance<?>> instances)
+   {
+      BeanStore beanStore = new HashMapBeanStore();
+      for (Map.Entry<String, ContextualInstance<?>> i : instances.entrySet())
+      {
+         beanStore.put(i.getKey(), i.getValue());
+      }
+      return beanStore;
+   }
+
+   @SuppressWarnings("unchecked")
+   protected void replicateSession(int fromId, BeanManagerImpl fromBeanManager, int toId, BeanManagerImpl toBeanManager) throws Exception
+   {
+      // Mimic replicating the session
+      BeanStore sessionBeanStore = fromBeanManager.getServices().get(ContextLifecycle.class).getSessionContext().getBeanStore();
+      Map<String, ContextualInstance<?>> contextuals = getContextualInstances(sessionBeanStore);
+      byte[] bytes = serialize(contextuals);
+      use(toId);
+      BeanStore replicatedSessionBeanStore = setContextualInstances((Map<String, ContextualInstance<?>>) deserialize(bytes));
+      toBeanManager.getServices().get(ContextLifecycle.class).getSessionContext().setBeanStore(replicatedSessionBeanStore);
+      use(fromId);
+   }
+
+   protected byte[] serialize(Object instance) throws IOException
+   {
+      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+      ObjectOutputStream out = new ObjectOutputStream(bytes);
+      out.writeObject(instance);
+      return bytes.toByteArray();
+   }
+
+   protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+   {
+      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
+      return in.readObject();
+   }
+
+   protected void useNewClassLoader(ClassLoader parentClassLoader)
+   {
+      ((SwitchableCLProxyServices)Container.instance().services().get(ProxyServices.class)).useNewClassLoader(parentClassLoader);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/ClusterClassLoader.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/ClusterClassLoader.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/ClusterClassLoader.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,33 @@
+/*
+ * 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.mock.cluster;
+
+/**
+ * Class loader (CL) used during cluster tests so that proxies are not loaded into the
+ * CL being used by the test framework.
+ * 
+ * @author David Allen
+ *
+ */
+public class ClusterClassLoader extends ClassLoader
+{
+   public ClusterClassLoader(ClassLoader parentClassLoader)
+   {
+      super(parentClassLoader);
+   }
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableCLProxyServices.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableCLProxyServices.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableCLProxyServices.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,63 @@
+/*
+ * 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.mock.cluster;
+
+import org.jboss.weld.bean.proxy.util.SimpleProxyServices;
+import org.jboss.weld.exceptions.WeldException;
+
+/**
+ * Uses a special CL to hold the proxies and allows a test to switch to a new
+ * CL. This is useful for testing cluster environments where the VMs are
+ * different and thus the CL would also be different between serialization and
+ * deserialization.
+ * 
+ * @author David Allen
+ */
+public class SwitchableCLProxyServices extends SimpleProxyServices
+{
+   private ClassLoader currentClassLoader;
+
+   @Override
+   public ClassLoader getClassLoader(Class<?> type)
+   {
+      if (currentClassLoader == null)
+      {
+         ClassLoader baseClassLoader = super.getClassLoader(type);
+         useNewClassLoader(baseClassLoader);
+      }
+      return currentClassLoader;
+   }
+
+   @Override
+   public Class<?> loadProxySuperClass(String className)
+   {
+      try
+      {
+         return currentClassLoader.loadClass(className);
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new WeldException(e);
+      }
+   }
+
+   public void useNewClassLoader(ClassLoader parentClassLoader)
+   {
+      currentClassLoader = new ClusterClassLoader(parentClassLoader);
+   }
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableMockEELifecycle.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableMockEELifecycle.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableMockEELifecycle.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.mock.cluster;
+
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.serialization.spi.ProxyServices;
+
+public class SwitchableMockEELifecycle extends MockEELifecycle
+{
+   private SwitchableCLProxyServices proxyServices;
+   
+   public SwitchableMockEELifecycle()
+   {
+      proxyServices = new SwitchableCLProxyServices();
+      getDeployment().getServices().add(ProxyServices.class, proxyServices);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableSingletonProvider.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableSingletonProvider.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/SwitchableSingletonProvider.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock.cluster;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.jboss.weld.bootstrap.api.Singleton;
+import org.jboss.weld.bootstrap.api.SingletonProvider;
+
+public class SwitchableSingletonProvider extends SingletonProvider
+{
+   
+   public static void use(Integer id)
+   {
+      if (id == null)
+      {
+         throw new IllegalArgumentException("id cannot be null");
+      }
+      SwitchableSingleton.id = id;
+   }
+   
+   private static class SwitchableSingleton<T> implements Singleton<T>
+   {
+      
+      private static Integer id = 0;
+      
+      private final Map<Integer, T> store;
+      
+      public SwitchableSingleton()
+      {
+         this.store = new Hashtable<Integer, T>();
+      }
+
+      public void clear()
+      {
+         store.remove(id);
+      }
+
+      public T get()
+      {
+         return store.get(id);
+      }
+
+      public boolean isSet()
+      {
+         return store.containsKey(id);
+      }
+
+      public void set(T object)
+      {
+         store.put(id, object);         
+      }
+      
+   }
+
+   @Override
+   public <T> Singleton<T> create(Class<? extends T> expectedType)
+   {
+      return new SwitchableSingleton<T>();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/el/EL.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/el/EL.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/el/EL.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.mock.el;
+
+import javax.el.ArrayELResolver;
+import javax.el.BeanELResolver;
+import javax.el.CompositeELResolver;
+import javax.el.ELContext;
+import javax.el.ELContextEvent;
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.ListELResolver;
+import javax.el.MapELResolver;
+import javax.el.ResourceBundleELResolver;
+import javax.el.VariableMapper;
+
+import org.jboss.weld.el.WeldELContextListener;
+import org.jboss.weld.el.WeldExpressionFactory;
+import org.jboss.weld.manager.BeanManagerImpl;
+
+import com.sun.el.ExpressionFactoryImpl;
+import com.sun.el.lang.FunctionMapperImpl;
+import com.sun.el.lang.VariableMapperImpl;
+
+/**
+ * An instance of JBoss EL.
+ * 
+ * @author Gavin King
+ *
+ */
+public class EL
+{
+   
+   public static final ExpressionFactory EXPRESSION_FACTORY = new WeldExpressionFactory(new ExpressionFactoryImpl());
+   
+   public static final ELContextListener[] EL_CONTEXT_LISTENERS = { new WeldELContextListener() };
+   
+   private static ELResolver createELResolver(BeanManagerImpl beanManagerImpl)
+   {
+      CompositeELResolver resolver = new CompositeELResolver();
+      resolver.add( beanManagerImpl.getELResolver() );
+      resolver.add( new MapELResolver() );
+      resolver.add( new ListELResolver() );
+      resolver.add( new ArrayELResolver() );
+      resolver.add( new ResourceBundleELResolver() );
+      resolver.add( new BeanELResolver() );
+      return resolver;
+   }
+
+   public static ELContext createELContext(BeanManagerImpl beanManagerImpl) {
+       return createELContext(createELResolver(beanManagerImpl), new FunctionMapperImpl() );
+   }
+   
+   public static ELContext createELContext(final ELResolver resolver, final FunctionMapper functionMapper)
+   {
+      ELContext context = new ELContext()
+      {
+         final VariableMapperImpl variableMapper = new VariableMapperImpl();
+
+         @Override
+         public ELResolver getELResolver()
+         {
+            return resolver;
+         }
+
+         @Override
+         public FunctionMapper getFunctionMapper()
+         {
+            return functionMapper;
+         }
+
+         @Override
+         public VariableMapper getVariableMapper()
+         {
+            return variableMapper;
+         }
+         
+      };
+      callELContextListeners(context);
+      return context;
+   }
+   
+   public static void callELContextListeners(ELContext context)
+   {
+      ELContextEvent event = new ELContextEvent(context);
+      for (ELContextListener listener : EL_CONTEXT_LISTENERS)
+      {
+         listener.contextCreated(event);
+      }
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive
===================================================================
--- core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive	                        (rev 0)
+++ core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1 @@
+org.jboss.shrinkwrap.impl.BeanArchiveImpl
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,60 @@
+package org.jboss.weld.tests;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.jboss.shrinkwrap.impl.base.URLPackageScanner;
+import org.junit.runners.Suite;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+
+public class AllTestRunner extends Suite
+{
+   public AllTestRunner(Class<?> superClass, RunnerBuilder builder) throws InitializationError
+   {
+      super(builder, superClass, getAllClasses());
+   }
+
+   private static Class<?>[] getAllClasses() 
+   {
+      final List<Class<?>> classes = new ArrayList<Class<?>>();
+      final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+      URLPackageScanner.newInstance(
+            AllTestRunner.class.getPackage(), 
+            true, 
+            classLoader, 
+            new URLPackageScanner.Callback()
+            {
+               public void classFound(String className)
+               {
+                  if(!className.endsWith("Test"))
+                  {
+                     return;
+                  }
+                  if(className.substring(className.lastIndexOf('.') +1).length() <= 4)
+                  {
+                     return;
+                  }
+                  try
+                  {
+                     classes.add(classLoader.loadClass(className));
+                  } 
+                  catch (Exception e) 
+                  {
+                     throw new RuntimeException(e);
+                  }
+               }
+            }).scanPackage();
+      
+      Collections.sort(classes, new Comparator<Class<?>>()
+      {
+         public int compare(Class<?> o1, Class<?> o2)
+         {
+            return o1.getPackage().getName().compareTo(o2.getPackage().getName());
+         }
+      });
+      return classes.toArray(new Class<?>[]{});
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests;
+
+import org.junit.runner.RunWith;
+
+/**
+ * Dummy test class to scan classpath for all Tests.
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+ at RunWith(AllTestRunner.class)
+public class AllTests
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.tests.category.Integration;
+
+/**
+ * CategoryArchiveAppender
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class CategoryArchiveAppender implements AuxiliaryArchiveAppender
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.arquillian.spi.AuxiliaryArchiveAppender#createAuxiliaryArchive()
+    */
+   public Archive<?> createAuxiliaryArchive()
+   {
+      return ShrinkWrap.create("weld-core-test-categories.jar", JavaArchive.class)
+                        .addPackage(Integration.class.getPackage());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests;
+
+import org.jboss.weld.tests.category.Broken;
+import org.junit.experimental.categories.Categories;
+import org.junit.experimental.categories.Categories.ExcludeCategory;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * IntegrationSuite
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+ at RunWith(Categories.class)
+//@IncludeCategory(Integration.class) // this will exclude un marked tests as well. 
+ at ExcludeCategory(Broken.class)
+ at SuiteClasses(AllTests.class)
+public class IntegrationSuite
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,36 @@
+package org.jboss.weld.tests;
+
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+public class MyTest
+{
+   @Test
+   @Category(Integration.class)
+   public void integration() 
+   {
+      System.out.println("integration");
+   }
+
+   @Test
+   @Category(Broken.class)
+   public void broken() 
+   {
+      System.out.println("broken");
+   }
+   
+   @Test
+   public void unmarked() 
+   {
+      System.out.println("unmarked");
+   }
+
+   @Test
+   @Category({Integration.class, Broken.class})
+   public void brokenintegration() 
+   {
+      System.out.println("brokenintegration");
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests;
+
+import org.jboss.weld.tests.category.ExcludeFromNormalSuite;
+import org.junit.experimental.categories.Categories;
+import org.junit.experimental.categories.Categories.ExcludeCategory;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * IntegrationSuite
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+ at RunWith(Categories.class)
+ at ExcludeCategory(ExcludeFromNormalSuite.class)
+ at SuiteClasses(AllTests.class) 
+public class NormalSuite
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.alternatives;
+
+
+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.JavaArchive;
+import org.junit.Assert;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class Alternatives2Test
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(Alternatives2Test.class.getPackage())
+         .as(JavaArchive.class);
+   }
+
+   @org.junit.Test
+   public void testAlternativesOnProducers(Consumer consumer)
+   {
+      Assert.assertEquals("Normal", consumer.getFoo().getName());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.alternatives;
+
+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.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class AlternativesTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .stereotype(Test.class)
+         .addPackage(Alternatives2Test.class.getPackage());
+   }
+
+   @org.junit.Test
+   public void testAlternativesOnProducers(Consumer consumer)
+   {
+      Assert.assertEquals("Test", consumer.getFoo().getName());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.alternatives;
+
+import javax.inject.Inject;
+
+public class Consumer
+{
+
+   @Inject Foo foo;
+   
+   public Foo getFoo()
+   {
+      return foo;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Foo.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.alternatives;
+
+public class Foo
+{
+   
+   private final String name;
+   
+   public Foo(String name)
+   {
+      this.name = name;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Producer.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Producer.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.alternatives;
+
+import javax.enterprise.inject.Produces;
+
+public class Producer
+{
+   
+   @Produces @Test 
+   public Foo getFoo() 
+   {
+      return new Foo("Test");
+   }
+   
+   @Produces
+   public Foo getManager() 
+   {
+      return new Foo("Normal");
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Test.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Test.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Test.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.alternatives;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Stereotype;
+
+ at Stereotype
+ at Alternative
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+public @interface Test {}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType;
+
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Bean
+{
+   int field;
+   
+   public Bean(int i)
+   {
+      
+   }
+   
+   public void method(int i)
+   {
+      
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType;
+
+
+public class Child extends Parent
+   {
+   }
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+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.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author kkahn
+ * 
+ */
+ at RunWith(Arquillian.class)
+public class DeclaringTypeTest
+{
+
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(DeclaringTypeTest.class.getPackage())
+         .as(JavaArchive.class);
+   }
+
+   @Inject
+   private BeanManager beanManager;
+   
+   @Test
+   public void testInheritance()
+   {
+      AnnotatedType<Child> type = beanManager.createAnnotatedType(Child.class);
+      Assert.assertEquals(1, type.getConstructors().size());
+      Assert.assertEquals(1, type.getFields().size());
+      for (AnnotatedField<? super Child> field : type.getFields())
+      {
+         if (field.getJavaMember().getName().equals("parent"))
+         {
+            Assert.assertEquals(Parent.class, field.getJavaMember().getDeclaringClass()); // OK
+                                                                                          // -
+                                                                                          // Returns
+                                                                                          // Parent
+            Assert.assertEquals(Parent.class, field.getDeclaringType().getJavaClass()); // FAIL
+                                                                                        // -
+                                                                                        // Returns
+                                                                                        // Child
+         }
+         else
+         {
+            Assert.fail("Unknown field " + field.getJavaMember());
+         }
+      }
+
+      Assert.assertEquals(1, type.getMethods().size());
+      for (AnnotatedMethod<? super Child> method : type.getMethods())
+      {
+         if (method.getJavaMember().getName().equals("parentMethod"))
+         {
+            Assert.assertEquals(Parent.class, method.getJavaMember().getDeclaringClass()); // OK
+                                                                                           // -
+                                                                                           // /Returns
+                                                                                           // Parent
+            Assert.assertEquals(Parent.class, method.getDeclaringType().getJavaClass()); // FAIL
+                                                                                         // -
+                                                                                         // Returns
+                                                                                         // Child
+         }
+         else
+         {
+            Assert.fail("Unknown method " + method.getJavaMember());
+         }
+      }
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType;
+
+import javax.enterprise.inject.spi.Annotated;
+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.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.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at RunWith(Arquillian.class)
+public class ExampleTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(ExampleTest.class.getPackage())
+         .as(JavaArchive.class);
+   }
+   
+   @Inject
+   private BeanManager beanManager;
+   
+   @Test
+   public void testAnnotatedCallableGetParameters() throws Exception 
+   {
+      AnnotatedType<Bean> type = beanManager.createAnnotatedType(Bean.class);
+      
+      assertNoAnnotations(type);
+      
+      Assert.assertEquals(1, type.getConstructors().size());
+      for (AnnotatedConstructor<Bean> ctor : type.getConstructors())
+      {
+         assertNoAnnotations(ctor);
+         
+         for (AnnotatedParameter<Bean> param : ctor.getParameters())
+         {
+            assertNoAnnotations(param);
+         }
+      }
+      
+      Assert.assertEquals(1, type.getMethods().size());
+      for (AnnotatedMethod<? super Bean> method : type.getMethods())
+      {
+         assertNoAnnotations(method);
+         
+         for (AnnotatedParameter<? super Bean> param : method.getParameters())
+         {
+            assertNoAnnotations(param);
+         }
+      }
+      
+      Assert.assertEquals(1, type.getFields().size());
+      for (AnnotatedField<? super Bean> field : type.getFields())
+      {
+         assertNoAnnotations(field);
+      }
+   }
+
+   private void assertNoAnnotations(Annotated annotated)
+   {
+      Assert.assertEquals(0, annotated.getAnnotations().size());
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType;
+public class Parent
+{
+   int parent;
+
+   void parentMethod()
+   {
+
+   }
+}
+

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.annotatedType.decoration;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+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.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at RunWith(Arquillian.class)
+public class AnnotatedTypeDecoratorTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(AnnotatedTypeDecoratorTest.class.getPackage())
+         .as(JavaArchive.class);
+   }
+   
+   @Inject
+   private BeanManager beanManager;
+   
+   @Test
+   public void testAnnotationDecorator() throws Exception 
+   {
+      NotAnnotated.reset();
+      AnnotatedType<NotAnnotated> type = beanManager.createAnnotatedType(NotAnnotated.class);
+      checkAnnotations(type, new NoAnnotationsChecker());
+      
+      type = new MockAnnotatedType<NotAnnotated>(type);
+      checkAnnotations(type, new MockAnnotationsChecker());
+      
+      NonContextual<NotAnnotated> nonContextual = new NonContextual<NotAnnotated>(beanManager, type);
+      NotAnnotated instance = nonContextual.create();
+      Assert.assertNotNull(instance);
+      nonContextual.postConstruct(instance);
+      
+      Assert.assertNotNull(instance.getFromField());
+      Assert.assertNotNull(NotAnnotated.getFromConstructor());
+      Assert.assertNotNull(NotAnnotated.getFromInitializer());
+   }
+   
+   private void checkAnnotations(AnnotatedType<NotAnnotated> type, TypeChecker checker)
+   {
+      checker.assertAnnotations(type);
+      
+      Assert.assertEquals(1, type.getConstructors().size());
+      
+      checker.assertAnnotations(type.getConstructors().iterator().next());
+      checker.assertAnnotations(type.getConstructors().iterator().next().getParameters().get(0));
+      
+      Assert.assertEquals(3, type.getFields().size());
+      for (AnnotatedField<? super NotAnnotated> field : type.getFields())
+      {
+         if (field.getJavaMember().getName().equals("fromField"))
+         {
+            checker.assertAnnotations(field);
+         }
+         else
+         {
+            Assert.assertEquals(0, field.getAnnotations().size());
+         }
+      }
+      Assert.assertEquals(5, type.getMethods().size());
+      checker.assertAnnotations(type.getMethods().iterator().next());
+   }
+
+
+
+
+   interface TypeChecker
+   {
+      void assertAnnotations(Annotated annotated);
+   }
+   
+   class NoAnnotationsChecker implements TypeChecker
+   {
+
+      public void assertAnnotations(Annotated annotated)
+      {
+         Assert.assertEquals(0, annotated.getAnnotations().size());
+      }
+   }
+   
+   class MockAnnotationsChecker implements TypeChecker
+   {
+
+      public void assertAnnotations(Annotated annotated)
+      {
+         if (annotated instanceof MockAnnotatedCallable)
+         {
+            Assert.assertEquals(1, annotated.getAnnotations().size());
+            Assert.assertTrue(annotated.isAnnotationPresent(Inject.class));
+         }
+         else if (annotated instanceof MockAnnotatedField<?>)
+         {
+            Assert.assertEquals(1, annotated.getAnnotations().size());
+            Assert.assertTrue(annotated.isAnnotationPresent(Inject.class));
+         }
+      }
+   }
+   
+   public class NonContextual<T> {
+
+      final InjectionTarget<T> it;
+      final BeanManager manager;
+      CreationalContext<T> cc;
+
+      public NonContextual(BeanManager manager, AnnotatedType<T> type) {
+         this.manager = manager;
+         this.it = manager.createInjectionTarget(type);
+         cc = manager.createCreationalContext(null);
+      }
+
+      public T create()
+      {
+         return it.produce(cc);
+      }
+      
+      public CreationalContext<T> postConstruct(T instance) {
+         it.inject(instance, cc);
+         it.postConstruct(instance);
+         return cc;
+      }
+
+      public void preDestroy(T instance) {
+         it.preDestroy(instance);
+      }
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/Foo.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/Foo.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/Foo.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */ 
+package org.jboss.weld.tests.annotatedType.decoration;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MockAnnotated implements Annotated
+{
+
+   private static class InjectLiteral extends AnnotationLiteral<Inject> implements Inject 
+   {
+      
+      public static final Inject INSTANCE = new InjectLiteral();
+      
+   }
+   
+   private Annotated delegate;
+   
+   public MockAnnotated(Annotated delegate)
+   {
+      this.delegate = delegate;
+   }
+
+   Annotated getDelegate()
+   {
+      return delegate;
+   }
+   
+   public Type getBaseType()
+   {
+      return delegate.getBaseType();
+   }
+
+   public Set<Type> getTypeClosure()
+   {
+      return delegate.getTypeClosure();
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      if (annotationType == Inject.class)
+      {
+         return (T) InjectLiteral.INSTANCE;
+      }
+      return null;
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      return Collections.singleton((Annotation) InjectLiteral.INSTANCE);
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return annotationType == Inject.class;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedCallable.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedCallable.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedCallable.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.inject.Inject;
+
+import org.jboss.annotation.factory.AnnotationCreator;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class MockAnnotatedCallable<X> extends MockAnnotatedMember<X> implements AnnotatedCallable<X>
+{
+   private final static Inject INITIALIZER;
+   static
+   {
+      try
+      {
+         INITIALIZER = (Inject)AnnotationCreator.createAnnotation("@" + Inject.class.getName(), Inject.class);
+      }
+      catch(Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   private final List<AnnotatedParameter<X>> parameters;
+
+   public MockAnnotatedCallable(Annotated delegate)
+   {
+      super(delegate);
+      parameters = initialiseParameters();
+   }
+
+   @Override
+   AnnotatedCallable<X> getDelegate()
+   {
+      return (AnnotatedCallable<X>) super.getDelegate();
+   }
+   
+   private List<AnnotatedParameter<X>> initialiseParameters()
+   {
+      int size = getDelegate().getParameters().size();
+      List<AnnotatedParameter<X>> params = new ArrayList<AnnotatedParameter<X>>(size);
+      if (size > 0)
+      {
+         for (AnnotatedParameter<X> param : getDelegate().getParameters())
+         {
+            params.add(new MockAnnotatedParameter<X>(param, this));
+         }
+      }
+      return params;
+   }
+
+   public List<AnnotatedParameter<X>> getParameters()
+   {
+      return parameters;
+   }
+   
+   @Override
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      if (annotationType == Inject.class)
+      {
+         return (T)INITIALIZER;
+      }
+      return null;
+   }
+
+   @Override
+   public Set<Annotation> getAnnotations()
+   {
+      return Collections.singleton((Annotation)INITIALIZER);
+   }
+
+   @Override
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return annotationType == Inject.class;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedConstructor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedConstructor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedConstructor.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+import java.lang.reflect.Constructor;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+class MockAnnotatedConstructor<X> extends MockAnnotatedCallable<X> implements AnnotatedConstructor<X>
+{
+   MockAnnotatedConstructor(AnnotatedConstructor<X> delegate)
+   {
+      super(delegate);
+   }
+
+   @Override
+   AnnotatedConstructor<X> getDelegate()
+   {
+      return (AnnotatedConstructor<X>)super.getDelegate();
+   }
+
+   public Constructor<X> getJavaMember()
+   {
+      return getDelegate().getJavaMember();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedField.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedField.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedField.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+class MockAnnotatedField<X> extends MockAnnotatedMember<X> implements AnnotatedField<X>
+{
+   MockAnnotatedField(AnnotatedField<? super X> delegate)
+   {
+      super(delegate);
+   }
+
+   @Override
+   AnnotatedField<X> getDelegate()
+   {
+      return (AnnotatedField<X>)super.getDelegate();
+   }
+
+   public Field getJavaMember()
+   {
+      return getDelegate().getJavaMember();
+   }
+
+   private boolean isDecoratedField()
+   {
+      return getJavaMember().getName().equals("fromField");
+   }
+   @Override
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      if (isDecoratedField())
+         return super.getAnnotation(annotationType);
+      return null;
+   }
+
+   @Override
+   public Set<Annotation> getAnnotations()
+   {
+      if (isDecoratedField())
+         return super.getAnnotations();
+      return Collections.emptySet();
+   }
+
+   @Override
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      if (isDecoratedField())
+         return super.isAnnotationPresent(annotationType);
+      return false;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMember.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMember.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMember.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class MockAnnotatedMember<X> extends MockAnnotated implements AnnotatedMember<X>
+{
+   public MockAnnotatedMember(Annotated delegate)
+   {
+      super(delegate);
+   }
+
+   @Override
+   AnnotatedMember<X> getDelegate()
+   {
+      return (AnnotatedMember<X>)super.getDelegate();
+   }
+   
+   public AnnotatedType<X> getDeclaringType()
+   {
+      return getDelegate().getDeclaringType();
+   }
+
+   public boolean isStatic()
+   {
+      return getDelegate().isStatic();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMethod.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMethod.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedMethod.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+import java.lang.reflect.Method;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MockAnnotatedMethod<X> extends MockAnnotatedCallable<X> implements AnnotatedMethod<X>
+{
+   public MockAnnotatedMethod(Annotated delegate)
+   {
+      // FIXME MDRAnnotatedMethod constructor
+      super(delegate);
+   }
+
+   @Override
+   public AnnotatedMethod<X> getDelegate()
+   {
+      return (AnnotatedMethod<X>)super.getDelegate();
+
+   }
+   
+   public Method getJavaMember()
+   {
+      return getDelegate().getJavaMember();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedParameter.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedParameter.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedParameter.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MockAnnotatedParameter<X> extends MockAnnotated implements AnnotatedParameter<X>
+{
+   private final AnnotatedCallable<X> callable;
+   
+   public MockAnnotatedParameter(Annotated delegate, AnnotatedCallable<X> callable)
+   {
+      super(delegate);
+      this.callable = callable;
+   }
+
+   @Override
+   AnnotatedParameter<X> getDelegate()
+   {
+      return (AnnotatedParameter<X>)super.getDelegate();
+   }
+
+   public AnnotatedCallable<X> getDeclaringCallable()
+   {
+      return callable;
+   }
+
+   public int getPosition()
+   {
+      return getDelegate().getPosition();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedType.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedType.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/MockAnnotatedType.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */ 
+package org.jboss.weld.tests.annotatedType.decoration;
+
+import java.util.HashSet;
+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;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+class MockAnnotatedType<X> extends MockAnnotated implements AnnotatedType<X>
+{
+   private final Set<AnnotatedConstructor<X>> annotatedConstructors;
+   
+   private final Set<AnnotatedField<? super X>> annotatedFields;
+   
+   private final Set<AnnotatedMethod<? super X>> annotatedMethods;
+   
+   MockAnnotatedType(AnnotatedType<X> delegate)
+   {
+      super(delegate);
+      annotatedConstructors = initialiseConstructors();
+      annotatedFields = initialiseAnnotatedFields();
+      annotatedMethods = initialiseMethods();
+   }
+   
+   private Set<AnnotatedField<? super X>> initialiseAnnotatedFields()
+   {
+      Set<AnnotatedField<? super X>> fields = new HashSet<AnnotatedField<? super X>>();
+      for (AnnotatedField<? super X> field : getDelegate().getFields())
+      {
+         if (field.isStatic())
+         {
+            fields.add(field);
+         }
+         else
+         {
+            fields.add(new MockAnnotatedField<X>(field));
+         }
+      }
+      return fields;
+   }
+   
+   private Set<AnnotatedConstructor<X>> initialiseConstructors()
+   {
+      Set<AnnotatedConstructor<X>> constructors = new HashSet<AnnotatedConstructor<X>>();
+      for (AnnotatedConstructor<X> constructor : getDelegate().getConstructors())
+      {
+         constructors.add(new MockAnnotatedConstructor<X>(constructor));
+      }
+      return constructors;
+   }
+   
+   private Set<AnnotatedMethod<? super X>> initialiseMethods()
+   {
+      Set<AnnotatedMethod<? super X>> methods = new HashSet<AnnotatedMethod<? super X>>();
+      for (AnnotatedMethod<? super X> method : getDelegate().getMethods())
+      {
+         if (method.isStatic())
+         {
+            methods.add(method);
+         }
+         else
+         {
+            methods.add(new MockAnnotatedMethod<X>(method));
+         }
+      }
+      return methods;
+   }
+   
+   @Override
+   AnnotatedType<X> getDelegate()
+   {
+      return (AnnotatedType<X>)super.getDelegate();
+   }
+   
+   public Set<AnnotatedConstructor<X>> getConstructors()
+   {
+      return annotatedConstructors;
+   }
+
+   public Set<AnnotatedField<? super X>> getFields()
+   {
+      return annotatedFields;
+   }
+
+   public Set<AnnotatedMethod<? super X>> getMethods()
+   {
+      return annotatedMethods;
+   }
+
+   public Class<X> getJavaClass()
+   {
+      return getDelegate().getJavaClass();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/NotAnnotated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/NotAnnotated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/NotAnnotated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.annotatedType.decoration;
+
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class NotAnnotated
+{
+   private static Foo fromConstructor;
+   
+   private static Foo fromInitialize;
+   
+   private Foo fromField;
+   
+   public NotAnnotated(Foo foo)
+   {
+      fromConstructor = foo;
+   }
+   
+   public void initialize(Foo foo)
+   {
+      fromInitialize = foo;
+   }
+   
+   /**
+    * @return the beanFromConstructor
+    */
+   public static Foo getFromConstructor()
+   {
+      return fromConstructor;
+   }
+   
+   /**
+    * @return the beanFromInitialize
+    */
+   public static Foo getFromInitializer()
+   {
+      return fromInitialize;
+   }
+   
+   /**
+    * @return the fromField
+    */
+   public Foo getFromField()
+   {
+      return fromField;
+   }
+   
+   public static void reset()
+   {
+      fromConstructor = null;
+      fromInitialize = null;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.category;
+
+
+/**
+ * Marker Interface for JUnit Category marking Broken tests 
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface Broken extends ExcludeFromNormalSuite 
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.category;
+
+/**
+ * Maker interface to work around JUnits single Category pr suite limitation
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface ExcludeFromNormalSuite
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.category;
+
+/**
+ * Marker Interface for JUnit Category marking tests that need a full container to run
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface Integration extends ExcludeFromNormalSuite
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface SimpleBean
+{
+   int echo1(int i);
+   
+   int echo2(int i);
+   
+   int echo3(int i);
+   
+   int echo4(int i);
+
+   boolean isInvoked();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleBeanImpl implements SimpleBean
+{
+
+   private boolean invoked  = false;
+
+   public int echo1(int i)
+   {
+      invoked = true;
+      return i;
+   }
+
+   public int echo2(int i)
+   {
+      invoked = true;
+      return i;
+   }
+
+   public int echo3(int i)
+   {
+      invoked = true;
+      return i;
+   }
+
+   public int echo4(int i)
+   {
+      invoked = true;
+      return i;
+   }
+
+   public boolean isInvoked()
+   {
+      return invoked;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Decorator
+public abstract class SimpleDecorator1 implements SimpleBean
+{
+   @Inject @Delegate
+   SimpleBean delegate;
+   
+   public static boolean echo1;
+   public static boolean echo3;
+   
+   public static void reset()
+   {
+      echo1 = false;
+      echo3 = false;
+   }
+   
+   public int echo1(int i)
+   {
+      echo1 = true;
+      return delegate.echo1(i);
+   }
+
+   public int echo3(int i)
+   {
+      echo3 = true;
+      return delegate.echo3(i);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Decorator
+public abstract class SimpleDecorator2 implements SimpleBean
+{
+   @Inject  @Delegate
+   SimpleBean delegate;
+   
+   public static boolean echo2;
+   public static boolean echo3;
+   
+   public static void reset()
+   {
+      echo2 = false;
+      echo3 = false;
+   }
+
+   public int echo2(int i)
+   {
+      echo2 = true;
+      return delegate.echo2(i);
+   }
+
+   public int echo3(int i)
+   {
+      echo3 = true;
+      return delegate.echo3(i);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators;
+
+import junit.framework.Assert;
+
+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;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at RunWith(Arquillian.class)
+public class SimpleDecoratorTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(SimpleDecorator1.class, SimpleDecorator2.class)   
+         .addPackage(SimpleDecoratorTest.class.getPackage());
+   }
+   
+   @Test
+   public void testSimpleDecorator(SimpleBean simpleBean)
+   {
+      resetDecorators();
+      Assert.assertEquals(1, simpleBean.echo1(1));
+      assertDecorators(true, false, false);
+      Assert.assertTrue(simpleBean.isInvoked());
+
+      resetDecorators();
+      Assert.assertEquals(2, simpleBean.echo2(2));
+      assertDecorators(false, true, false);
+      Assert.assertTrue(simpleBean.isInvoked());
+
+      //Only SimpleDecorator1 gets invoked, although I think SimpleDecorator2 should get invoked too
+      resetDecorators();
+      Assert.assertEquals(3, simpleBean.echo3(3));
+      assertDecorators(false, false, true);
+
+      Assert.assertTrue(simpleBean.isInvoked());
+
+      resetDecorators();
+      Assert.assertEquals(4, simpleBean.echo4(4));
+      assertDecorators(false, false, false);
+
+      Assert.assertTrue(simpleBean.isInvoked());
+   }
+
+   private void resetDecorators()
+   {
+      SimpleDecorator1.reset();
+      SimpleDecorator2.reset();
+   }
+
+   private void assertDecorators(boolean echo1, boolean echo2, boolean echo3)
+   {
+      Assert.assertEquals(echo1, SimpleDecorator1.echo1);
+      Assert.assertEquals(echo2, SimpleDecorator2.echo2);
+      Assert.assertEquals(echo3, SimpleDecorator2.echo3);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class AbstractDecoratorTestHelper
+{
+   static void resetAll()
+   {
+      WindowImpl.drawn = false;
+      WindowImpl.moved = false;
+      FrameWithFieldInjectedDelegate.drawn = false;
+      FrameWithFieldInjectedDelegateAndAbstractMethod.moved = false;
+      FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved = false;
+      FrameWithConstructorInjectedDelegate.drawn = false;
+      FrameWithConstructorInjectedDelegateAndAbstractMethod.moved = false;
+      FrameWithInitializerMethodInjectedDelegate.drawn = false;
+      FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved = false;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class FrameWithConstructorInjectedDelegate implements Window
+{
+
+   static boolean drawn;
+
+   Window window;
+
+   @Inject
+   FrameWithConstructorInjectedDelegate(@Delegate Window window)
+   {
+      this.window = window;
+   }
+
+   public void draw()
+   {
+      drawn = true;
+      window.draw();
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class FrameWithConstructorInjectedDelegateAndAbstractMethod implements Window
+{
+
+   Window window;
+
+   static boolean moved = false;
+
+   @Inject
+   FrameWithConstructorInjectedDelegateAndAbstractMethod(@Delegate Window window)
+   {
+      this.window = window;
+   }
+
+   public abstract void draw();
+
+   public void move()
+   {
+     moved = true;
+     draw();
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class FrameWithFieldInjectedDelegate implements Window
+{
+
+   static boolean drawn;
+
+   @Inject @Delegate
+   Window window;
+
+   public void draw()
+   {
+     drawn = true;
+     window.draw();
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class FrameWithFieldInjectedDelegateAndAbstractMethod implements Window
+{
+
+   static boolean moved;
+
+   @Inject @Delegate
+   Window window;
+
+   public abstract void draw();
+
+   public void move()
+   {
+      moved = true;
+      window.move();
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod implements Window
+{
+
+   static boolean moved;
+
+   @Inject @Delegate
+   Window window;
+
+   public abstract void draw();
+
+   public void move()
+   {
+      moved = true;
+      draw();
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class FrameWithInitializerMethodInjectedDelegate implements Window
+{
+
+   static boolean drawn;
+
+   private Window window;
+
+   @Inject
+   void initWindow(@Delegate Window window){
+      this.window = window;
+   }
+
+   public void draw() {
+      drawn = true;
+      window.draw();
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class FrameWithInitializerMethodInjectedDelegateAndAbstractMethod implements Window
+{
+
+   static boolean moved;
+
+   private Window window;
+
+   @Inject
+   void initWindow(@Delegate Window window)
+   {
+      this.window = window;
+   }
+
+   public abstract void draw();
+
+   public void move()
+   {
+      moved = true;
+      window.move();
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+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 <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorTest 
+{
+   @Deployment
+   public static Archive<?> deploy()
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+            .decorate(FrameWithFieldInjectedDelegate.class)
+            .addPackage(SimpleAbstractDecoratorTest.class.getPackage());
+   }
+
+   @Test
+   public void testAbstractDecoratorApplied(WindowImpl window)
+   {
+      resetAll();
+
+      window.draw();
+      Assert.assertTrue(WindowImpl.drawn);
+      Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+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 <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(
+               FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.class, 
+               FrameWithFieldInjectedDelegate.class)
+         .addPackage(SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.class.getPackage());
+   }
+
+   @Test
+   public void testAbstractDecoratorApplied(WindowImpl window)
+   {
+      resetAll();
+      window.draw();
+      Assert.assertTrue(WindowImpl.drawn);
+      Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+      Assert.assertFalse(FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved);
+
+      resetAll();
+      window.move();
+      Assert.assertTrue(WindowImpl.moved);
+      Assert.assertFalse(FrameWithFieldInjectedDelegate.drawn);
+      Assert.assertTrue(FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved);
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+import junit.framework.Assert;
+
+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;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithAbstractMethodTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(
+               FrameWithFieldInjectedDelegateAndAbstractMethod.class, 
+               FrameWithFieldInjectedDelegate.class)
+         .addPackage(SimpleAbstractDecoratorWithAbstractMethodTest.class.getPackage());
+   }
+
+   @Test
+   public void testAbstractDecoratorApplied(WindowImpl window)
+   {
+      resetAll();
+      window.draw();
+      Assert.assertTrue(WindowImpl.drawn);
+      Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+      Assert.assertFalse(FrameWithFieldInjectedDelegateAndAbstractMethod.moved);
+
+      resetAll();
+      window.move();
+      Assert.assertTrue(WindowImpl.moved);
+      Assert.assertFalse(FrameWithFieldInjectedDelegate.drawn);
+      Assert.assertTrue(FrameWithFieldInjectedDelegateAndAbstractMethod.moved);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+import junit.framework.Assert;
+
+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;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithCallToItselfTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(
+               FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.class, 
+               FrameWithFieldInjectedDelegate.class)
+         .addPackage(SimpleAbstractDecoratorWithCallToItselfTest.class.getPackage());
+   }
+   
+   @Test
+   public void testAbstractDecoratorApplied(WindowImpl window)
+   {
+      resetAll();
+      window.move();
+      Assert.assertTrue(WindowImpl.drawn);
+      Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+      Assert.assertTrue(FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+import junit.framework.Assert;
+
+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;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithConstructorTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(
+               FrameWithConstructorInjectedDelegateAndAbstractMethod.class, 
+               FrameWithConstructorInjectedDelegate.class)
+         .addPackage(SimpleAbstractDecoratorWithConstructorTest.class.getPackage());
+   }
+
+   @Test
+   public void testAbstractDecoratorApplied(WindowImpl window)
+   {
+      resetAll();
+
+      window.draw();
+      Assert.assertTrue(WindowImpl.drawn);
+      Assert.assertTrue(FrameWithConstructorInjectedDelegate.drawn);
+
+      resetAll();
+      window.move();
+      Assert.assertFalse(WindowImpl.moved);
+      Assert.assertTrue(WindowImpl.drawn);
+      Assert.assertTrue(FrameWithConstructorInjectedDelegate.drawn);
+      Assert.assertTrue(FrameWithConstructorInjectedDelegateAndAbstractMethod.moved);
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+import junit.framework.Assert;
+
+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;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithInitializerMethodTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(FrameWithInitializerMethodInjectedDelegate.class)
+         .addPackage(SimpleAbstractDecoratorWithInitializerMethodTest.class.getPackage());
+   }
+
+   @Test
+   public void testAbstractDecoratorApplied(WindowImpl window)
+   {
+      resetAll();
+
+      window.draw();
+      Assert.assertTrue(WindowImpl.drawn);
+      Assert.assertTrue(FrameWithInitializerMethodInjectedDelegate.drawn);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Window
+{
+   void draw();
+
+   void move();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator;
+
+/**
+ *
+ * @author Marius Bogoevici
+ */
+public class WindowImpl implements Window
+{
+   static boolean drawn;
+
+   static boolean moved;
+
+   public void draw()
+   {
+      drawn = true;
+   }
+
+   public void move()
+   {
+      moved = true; 
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Frame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Frame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Frame.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator.broken;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+ at Decorator
+public abstract class Frame
+{
+
+   @Inject @Delegate
+   Window window;
+
+   public void draw()
+   {
+      window.draw();
+   }
+
+   public abstract void resize();
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.abstractDecorator.broken;
+
+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.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+//@ExpectedDeploymentException(DefinitionException.class)
+ at RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithInvalidAbstractMethodTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(Frame.class)
+         .addPackage(SimpleAbstractDecoratorWithInvalidAbstractMethodTest.class.getPackage());
+   }
+   
+   @Test
+   @Category(Broken.class)
+   // TODO: needs exception transformer to run in JBAS
+   public void testAbstractDecoratorApplied()
+   {
+      Assert.assertFalse(false);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Window.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Window.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/Window.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.abstractDecorator.broken;
+
+/**
+ *
+ * @author Marius Bogoevici
+ */
+public class Window
+{
+   static boolean drawn;
+
+   static boolean moved;
+
+   public void draw()
+   {
+      drawn = true;
+   }
+
+   public void move()
+   {
+      moved = true;
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,176 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.custom;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldField;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.resources.ClassTransformer;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class CustomDecorator implements Decorator<Object>
+{
+   private final Set<InjectionPoint> injectionPoints;
+   private BeanManager beanManager;
+
+   public CustomDecorator(BeanManager beanManager)
+   {
+      this.beanManager = beanManager;
+      injectionPoints = Collections.singleton((InjectionPoint)new CustomInjectionPoint());
+   }
+
+   public Type getDelegateType()
+   {
+      return Window.class;
+   }
+
+   public Set<Annotation> getDelegateQualifiers()
+   {
+      return Collections.emptySet();
+   }
+
+   public Set<Type> getDecoratedTypes()
+   {
+      return Collections.singleton((Type) Window.class);
+   }
+
+   public Set<Type> getTypes()
+   {
+      return Collections.<Type>singleton(CustomWindowFrame.class);
+   }
+
+   public Set<Annotation> getQualifiers()
+   {
+      return Collections.emptySet();
+   }
+
+   public Class<? extends Annotation> getScope()
+   {
+      return Dependent.class;
+   }
+
+   public String getName()
+   {
+      return null;
+   }
+
+   public Set<Class<? extends Annotation>> getStereotypes()
+   {
+      return Collections.emptySet();
+
+   }
+
+   public Class<?> getBeanClass()
+   {
+      return CustomWindowFrame.class;
+   }
+
+   public boolean isAlternative()
+   {
+      return false;
+   }
+
+   public boolean isNullable()
+   {
+      return false;
+   }
+
+   public Set<InjectionPoint> getInjectionPoints()
+   {
+      return injectionPoints;
+   }
+
+   public Object create(CreationalContext<Object> creationalContext)
+   {
+      CustomWindowFrame customFrame = new CustomWindowFrame();
+      customFrame.window = (Window) beanManager.getInjectableReference(injectionPoints.iterator().next(), creationalContext);
+      return customFrame;
+   }
+
+   public void destroy(Object instance, CreationalContext<Object> creationalContext)
+   {
+      creationalContext.release();
+   }
+
+   class CustomInjectionPoint implements InjectionPoint
+   {
+      private final WeldClass<?> targetClass;
+      private final WeldField<CustomWindowFrame,?> windowField;
+
+      public CustomInjectionPoint()
+      {
+         ClassTransformer transformer = new ClassTransformer(new TypeStore());
+         targetClass = WeldClassImpl.of(CustomWindowFrame.class, transformer);
+         windowField = targetClass.getDeclaredWeldField("window");
+      }
+
+      public Type getType()
+      {
+         return Window.class;
+      }
+
+      public Set<Annotation> getQualifiers()
+      {
+         return Collections.<Annotation>singleton(DefaultLiteral.INSTANCE);
+      }
+
+      public Bean<?> getBean()
+      {
+         return CustomDecorator.this;
+      }
+
+      public Member getMember()
+      {
+         return ((AnnotatedField<?>)windowField).getJavaMember();
+      }
+
+      public Annotated getAnnotated()
+      {
+         return windowField;
+      }
+
+      public boolean isDelegate()
+      {
+         return true;
+      }
+
+      public boolean isTransient()
+      {
+         return false;
+      }
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorDeploymentObserver.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorDeploymentObserver.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorDeploymentObserver.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.custom;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+
+public class CustomDecoratorDeploymentObserver implements Extension
+{
+   public void addDecorators(@Observes AfterBeanDiscovery event, BeanManager beanManager)
+   {
+      event.addBean(new CustomDecorator(beanManager));
+   }
+
+   /**
+    * Must veto the custom decorator class, otherwise a bean will be created
+    */
+   public void vetoCustomDecorator(@Observes ProcessAnnotatedType event, BeanManager beanManager)
+   {
+      if (event.getAnnotatedType().getJavaClass().equals(CustomWindowFrame.class))
+         event.veto();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.custom;
+
+import java.util.Arrays;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+
+import junit.framework.Assert;
+
+import org.jboss.weld.manager.BeanManagerImpl;
+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.util.serviceProvider.PackageServiceLoaderFactory;
+import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
+import org.junit.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class CustomDecoratorTest
+{
+
+   @Test
+   public void testCustomDecoratorAppliedByItself()
+   {
+      MockBeanDeploymentArchive beanDeploymentArchive = new MockBeanDeploymentArchive("1", WindowImpl.class, CustomWindowFrame.class, InnerWindowFrame.class, OuterWindowFrame.class );
+      beanDeploymentArchive.setBeansXmlFiles(Arrays.asList(CustomDecoratorTest.class.getResource("beans-custom-only.xml")));
+      TestContainer testContainer = new TestContainer(new MockServletLifecycle(new MockDeployment(beanDeploymentArchive), beanDeploymentArchive));
+      testContainer.getLifecycle().initialize();
+      testContainer.getDeployment().getServices().add(ServiceLoaderFactory.class, new PackageServiceLoaderFactory(CustomDecoratorTest.class.getPackage(), Extension.class));
+      testContainer.getLifecycle().beginApplication();
+
+      BeanManagerImpl beanManager = testContainer.getBeanManager();
+      Bean<Object> windowBean = (Bean<Object>) beanManager.getBeans(WindowImpl.class).iterator().next();
+      CreationalContext<Object> creationalContext = beanManager.createCreationalContext(windowBean);
+      WindowImpl window  = (WindowImpl) windowBean.create(creationalContext);
+      window.draw();
+
+      Assert.assertTrue(window.isDrawn());
+      Assert.assertTrue(CustomWindowFrame.drawn);
+      testContainer.stopContainer();
+   }
+
+   @Test
+   public void testCustomDecoratorAppliedWithWeldDecorators()
+   {
+      MockBeanDeploymentArchive beanDeploymentArchive = new MockBeanDeploymentArchive("1", WindowImpl.class, CustomWindowFrame.class, InnerWindowFrame.class, OuterWindowFrame.class );
+      beanDeploymentArchive.setBeansXmlFiles(Arrays.asList(CustomDecoratorTest.class.getResource("beans.xml")));
+      TestContainer testContainer = new TestContainer(new MockServletLifecycle(new MockDeployment(beanDeploymentArchive), beanDeploymentArchive));
+      testContainer.getLifecycle().initialize();
+      testContainer.getDeployment().getServices().add(ServiceLoaderFactory.class, new PackageServiceLoaderFactory(CustomDecoratorTest.class.getPackage(), Extension.class));      
+      testContainer.getLifecycle().beginApplication();
+
+      BeanManagerImpl beanManager = testContainer.getBeanManager();
+      Bean<Object> windowBean = (Bean<Object>) beanManager.getBeans(WindowImpl.class).iterator().next();
+      CreationalContext<Object> creationalContext = beanManager.createCreationalContext(windowBean);
+      WindowImpl window  = (WindowImpl) windowBean.create(creationalContext);
+      window.draw();
+
+      Assert.assertTrue(window.isDrawn());
+      Assert.assertTrue(OuterWindowFrame.drawn);
+      Assert.assertTrue(InnerWindowFrame.drawn);
+      Assert.assertTrue(CustomWindowFrame.drawn);
+
+      testContainer.stopContainer();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.custom;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class CustomWindowFrame implements Window
+{
+   public static boolean drawn;
+
+   Window window;
+
+   public void draw()
+   {
+      window.draw();
+      drawn = true;   
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.custom;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class InnerWindowFrame implements Window
+{
+   static boolean drawn = false;
+
+   @Inject @Delegate
+   Window window;
+
+   public void draw()
+   {
+      window.draw();
+      drawn = true;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.custom;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class OuterWindowFrame implements Window
+{
+   static boolean drawn = false;
+
+   @Inject @Delegate
+   Window window;
+
+   public void draw()
+   {
+      window.draw();
+      drawn = true;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.custom;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Window
+{
+   void draw();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.custom;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class WindowImpl implements Window
+{
+   public boolean drawn = false;
+
+   public void draw()
+   {
+      drawn = true;
+   }
+
+   public boolean isDrawn()
+   {
+      return drawn;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.decoratedTypes;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Decorated
+{
+   void decoratedMethod();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.decoratedTypes;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface NotDecorated
+{
+   void notDecoratedMethod();
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.decoratedTypes;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class PartialDecorator implements Decorated
+{
+
+   @Inject @Delegate TestBean delegate;
+
+   static boolean decoratedInvoked;
+
+   static boolean notDecoratedInvoked;
+
+   public void decoratedMethod()
+   {
+      decoratedInvoked = true;
+      delegate.decoratedMethod();
+   }
+
+   /**
+    * Should not be invoked
+    */
+   public void notDecoratedMethod()
+   {
+      notDecoratedInvoked = true;
+      delegate.decoratedMethod();
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.decoratedTypes;
+
+import junit.framework.Assert;
+
+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;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at RunWith(Arquillian.class)
+public class PartialDecoratorTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(PartialDecorator.class)
+         .addPackage(PartialDecoratorTest.class.getPackage());
+   }
+   
+   @Test
+   public void testDecoratorDoesNotDecorateOutsideDecoratedTypes(TestBean testBean)
+   {
+      testBean.decoratedMethod();
+      testBean.notDecoratedMethod();
+
+      Assert.assertTrue(PartialDecorator.decoratedInvoked);
+      Assert.assertFalse(PartialDecorator.notDecoratedInvoked);
+      Assert.assertTrue(TestBean.decoratedInvoked);
+      Assert.assertTrue(TestBean.notDecoratedInvoked);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.decoratedTypes;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class TestBean implements Decorated, NotDecorated
+{
+   static boolean decoratedInvoked;
+   static boolean notDecoratedInvoked;
+
+   public void decoratedMethod()
+   {
+      decoratedInvoked = true;
+   }
+
+   public void notDecoratedMethod()
+   {
+      notDecoratedInvoked = true;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Decorated<T>
+{
+   T decoratedEcho(T parameter);
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class GenericBean<T> implements Decorated<T>, NotDecorated<T>
+{
+   static boolean decoratedInvoked;
+   static boolean notDecoratedInvoked;
+
+   public T notDecoratedEcho(T parameter)
+   {
+      notDecoratedInvoked = true;
+      return parameter;
+   }
+
+   public T decoratedEcho(T parameter)
+   {
+      decoratedInvoked = true;
+      return parameter;
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface NotDecorated<T>
+{
+   T notDecoratedEcho(T parameter);
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class PartialDecorator<T> implements Decorated<T>
+{
+
+   @Inject @Delegate GenericBean<T> delegate;
+
+   static boolean decoratedInvoked = false;
+
+   static boolean notDecoratedInvoked = false;
+
+   public T decoratedEcho(T parameter)
+   {
+      decoratedInvoked = true;
+      return delegate.decoratedEcho(parameter);
+   }
+
+   /**
+    * Should not be invoked
+    */
+   public T notDecoratedEcho(T parameter)
+   {
+      notDecoratedInvoked = true;
+      return delegate.notDecoratedEcho(parameter);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic;
+
+import junit.framework.Assert;
+
+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;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at RunWith(Arquillian.class)
+public class PartialDecoratorTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(PartialDecorator.class, StringPartialDecorator.class)
+         .addPackage(PartialDecoratorTest.class.getPackage());
+   }
+   
+   @Test
+   public void testDecoratorDoesNotDecorateOutsideDecoratedTypes(TestBean testBean)
+   {
+      testBean.invoke();
+
+      Assert.assertTrue(PartialDecorator.decoratedInvoked);
+      Assert.assertFalse(PartialDecorator.notDecoratedInvoked);
+      Assert.assertTrue(StringPartialDecorator.invoked);
+      Assert.assertTrue(GenericBean.decoratedInvoked);
+      Assert.assertTrue(GenericBean.notDecoratedInvoked);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class StringPartialDecorator implements Decorated<String>
+{
+   @Inject
+   @Delegate
+   GenericBean<String> delegate;
+
+   static boolean invoked = false;
+
+   public String decoratedEcho(String parameter)
+   {
+      invoked = true;
+      return delegate.decoratedEcho(parameter);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class TestBean
+{
+   @Inject @Dependent GenericBean<String> genericBean;
+
+   public void invoke()
+   {
+      genericBean.decoratedEcho("hello");
+      genericBean.notDecoratedEcho("hello");
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/Decorated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/Decorated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/Decorated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,26 @@
+/*
+ * 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.decorators.generic.extend;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Decorated<T>
+{
+   T decoratedEcho(T parameter);
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic.extend;
+
+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 ExtendDecoratorTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(ExtendsDecoratedDecorator.class)
+         .addPackage(ExtendDecoratorTest.class.getPackage());
+   }
+   
+   @Test
+   public void testExtendedDecorator(ExtendsDecorated instance)
+   {
+      String result = instance.decoratedEcho("hello");
+      Assert.assertEquals("decorated-hello-decorated", result);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecorated.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecorated.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecorated.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,25 @@
+/*
+ * 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.decorators.generic.extend;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface ExtendsDecorated extends Decorated<String>
+{
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic.extend;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class ExtendsDecoratedDecorator implements ExtendsDecorated
+{
+   @Inject @Delegate ExtendsDecorated delegate;
+
+   public String decoratedEcho(String parameter)
+   {
+      return "decorated-" + parameter + "-decorated";
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendsDecoratedImpl.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.generic.extend;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class ExtendsDecoratedImpl implements ExtendsDecorated
+{
+   public String decoratedEcho(String parameter)
+   {
+      return parameter;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Intercepted.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Intercepted.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Intercepted.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.interceptor;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+ at Inherited
+ at InterceptorBinding
+ at Target({ElementType.TYPE, ElementType.METHOD})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface Intercepted
+{
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.interceptor;
+
+import junit.framework.Assert;
+
+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 InterceptorAndDecoratorTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(ServiceDecorator.class)
+         .intercept(ServiceInterceptor.class)
+         .addPackage(InterceptorAndDecoratorTest.class.getPackage());
+   }
+   
+   @Test // description="WELD-314"
+   public void test(Service service)
+   {
+      ServiceImpl.invocationCount = 0;
+      ServiceDecorator.invocationCount = 0;
+      ServiceInterceptor.invocationCount = 0;
+      service.execute();
+      Assert.assertEquals(1, ServiceImpl.invocationCount);
+      Assert.assertEquals(1, ServiceDecorator.invocationCount);
+      Assert.assertEquals(1, ServiceInterceptor.invocationCount);
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Service.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Service.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/Service.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.interceptor;
+
+public interface Service
+{
+    void execute();
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.weld.tests.decorators.interceptor;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * Secure PaymentService implemented by decator
+ *
+ * @author wayne
+ */
+ at Decorator
+class ServiceDecorator implements Service
+{
+
+   @Inject
+   @Delegate
+   private Service service;
+
+   public static int invocationCount = 0;
+
+   public void execute()
+   {
+      invocationCount++;
+      service.execute();
+   }
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceImpl.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.interceptor;
+
+public class ServiceImpl implements Service
+{
+
+   public static int invocationCount = 0;
+
+   @Intercepted
+   public void execute()
+   {
+      invocationCount ++;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.interceptor;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+ at Intercepted @Interceptor
+public class ServiceInterceptor
+{
+
+   public static int invocationCount = 0;
+
+   @AroundInvoke
+   public Object interceptService(InvocationContext invocationContext) throws Exception
+   {
+      invocationCount++;
+      return invocationContext.proceed();
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.multidelegate;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+public interface Account extends Serializable 
+{
+   
+   public String withdraw(BigDecimal amount);
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account1.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account1.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account1.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.multidelegate;
+
+import java.math.BigDecimal;
+
+public class Account1 implements Account {
+
+   public String withdraw(BigDecimal amount) {
+      return "Account1 withdraw";
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account2.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account2.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/Account2.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.multidelegate;
+
+import java.math.BigDecimal;
+
+public class Account2 implements Account {
+
+   public String withdraw(BigDecimal amount) {
+      return "Account2 withdraw";
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/AccountDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/AccountDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/AccountDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.multidelegate;
+
+import java.math.BigDecimal;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+ at Decorator
+public class AccountDecorator implements Account {
+   
+   @Inject @Delegate @Any Account account;
+
+   public String withdraw(BigDecimal amount) {
+      System.out.println("AccountDecorator withdraw " + account.toString());
+      return account.withdraw(amount);
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.multidelegate;
+
+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 TestMultiDelegate
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(AccountDecorator.class)
+         .addPackage(TestMultiDelegate.class.getPackage());
+   }
+   
+   /**
+    * description="http://seamframework.org/Community/SerializableDecorators"
+    */
+   @Test
+   public void go() {
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,57 @@
+/*
+ * 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.decorators.resolution;
+
+import junit.framework.Assert;
+
+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;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at RunWith(Arquillian.class)
+public class BasicDecoratorResolutionTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+               .decorate(SimpleDecorator.class, ComplexDecorator.class)
+               .addPackage(BasicDecoratorResolutionTest.class.getPackage());
+   }
+
+   @Test
+   public void testBasicDecoratorInvocation(@Simple SimpleBean simpleBean)
+   {
+      String result = simpleBean.hello("world");
+      Assert.assertEquals("simple-Hello, world-simple", result);
+   }
+
+   @Test
+   public void testComplexDecoratorInvocation(@Complex ComplexBean complexBean)
+   {
+      String result = complexBean.hello("world");
+      Assert.assertEquals("simple-complex-Sophisticated Hello, world-complex-simple", result);
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.decorators.resolution;
+
+import javax.inject.Qualifier;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER})
+ at Documented
+public @interface Complex
+{
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,31 @@
+/*
+ * 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.decorators.resolution;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Complex
+public class ComplexBean implements SomeBean
+{
+   public String hello(String name)
+   {
+      return "Sophisticated Hello, " + name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/ComplexDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,37 @@
+/*
+ * 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.decorators.resolution;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class ComplexDecorator implements SomeBean
+{
+   @Inject @Delegate @Any ComplexBean delegate;
+
+   public String hello(String name)
+   {
+       return "complex-" +delegate.hello(name) +"-complex";
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/DecoratorResolutionTestsHelper.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/DecoratorResolutionTestsHelper.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/DecoratorResolutionTestsHelper.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,42 @@
+/*
+ * 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.decorators.resolution;
+
+import javax.enterprise.inject.spi.Decorator;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class DecoratorResolutionTestsHelper
+{
+   public static boolean decoratorClassesMatch(List<Decorator<?>> decoratorList, Collection<Class<?>> expectedDecoratorClasses)
+   {
+      if (decoratorList.size() != expectedDecoratorClasses.size())
+         return false;
+      Collection<Class<?>> expectedDecoratedClassesCopy = new ArrayList<Class<?>>(expectedDecoratorClasses);
+      for (Decorator<?> decorator: decoratorList)
+      {
+         if (!expectedDecoratedClassesCopy.remove(decorator.getBeanClass()))
+            return false;
+      }
+      return expectedDecoratedClassesCopy.size() == 0;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,37 @@
+/*
+ * 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.decorators.resolution;
+
+import javax.inject.Qualifier;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Qualifier
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER})
+ at Documented
+public @interface Simple
+{
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,31 @@
+/*
+ * 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.decorators.resolution;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Simple
+public class SimpleBean implements SomeBean
+{
+   public String hello(String name)
+   {
+      return "Hello, " + name;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleDecorator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleDecorator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SimpleDecorator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,37 @@
+/*
+ * 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.decorators.resolution;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class SimpleDecorator implements SomeBean
+{
+   @Inject @Delegate @Any SomeBean delegate;
+
+   public String hello(String name)
+   {
+      return "simple-" +delegate.hello(name) +"-simple";
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SomeBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SomeBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/SomeBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,26 @@
+/*
+ * 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.decorators.resolution;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface SomeBean
+{
+   String hello(String name);
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/LogFacatory.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.stackoverflow;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Factory class that produces Logger for a given be to injected class
+ *
+ * @author wayne
+ */
+public class LogFacatory {
+    @Produces
+    public Logger getLogger(InjectionPoint ip){
+        return LoggerFactory.getLogger(ip.getMember().getDeclaringClass());
+    }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/PaymentService.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author wayne
+ */
+public interface PaymentService {
+    boolean pay(String account, BigDecimal amount);
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SecurePaymentService.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+import org.slf4j.Logger;
+
+/**
+ * Secure PaymentService implemented by decator
+ * 
+ * @author wayne
+ */
+ at Decorator
+class SecurePaymentService implements PaymentService
+{
+   @Inject
+   private Logger logger;
+
+   @Inject
+   @Delegate
+   @SimpleService
+   private PaymentService paymentService;
+
+   public boolean pay(String account, BigDecimal amount)
+   {
+      logger.info("I'm a secure payment service");
+
+      return paymentService.pay(account, amount);
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimplePaymentService.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.slf4j.Logger;
+
+/**
+ * 
+ * @author wayne
+ */
+ at SimpleService
+ at ApplicationScoped
+public class SimplePaymentService implements PaymentService
+{
+   @Inject
+   Logger logger;
+
+   public boolean pay(String account, BigDecimal amount)
+   {
+      logger.info("Pay ${} for {}.", amount, account);
+
+      return true;
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/SimpleService.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.stackoverflow;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author wayne
+ */
+ at Qualifier
+ at Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface SimpleService {
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.decorators.stackoverflow;
+
+import java.math.BigDecimal;
+
+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 StackOverFlowTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .decorate(SecurePaymentService.class)
+         .addPackage(StackOverFlowTest.class.getPackage());
+   }
+   
+   /**
+    * description="WELD-296" 
+    */
+   @Test
+   public void test(@SimpleService PaymentService paymentService)
+   {
+      paymentService.pay("Pete", new BigDecimal(100));
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import junit.framework.Assert;
+
+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.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ExampleTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(ExampleTest.class.getPackage())
+         .as(JavaArchive.class);
+   }
+
+   @Test
+   public void testGameGenerator(Game game1, Game game2, Generator gen1, Generator gen2) throws Exception 
+   {
+     Assert.assertNotSame(game1, game2);
+     Assert.assertNotSame(game1.getNumber(), game2.getNumber());
+     
+     Assert.assertNotNull(gen1.getRandom());
+     Assert.assertEquals(gen1.getRandom(), gen2.getRandom());
+   }
+
+   @Test
+   public void testSentenceTranslator(TextTranslator tt1) throws Exception 
+   {
+      try 
+      {
+         tt1.translate("hello world");
+         Assert.fail();
+      }
+      catch (UnsupportedOperationException uoe)
+      {
+         //expected
+      }
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Game.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Game.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Game.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import javax.inject.Inject;
+
+public class Game
+{
+   private final int number;
+   
+   @Inject
+   Game(@Random int number)
+   {
+      this.number = number;
+   }
+
+   public int getNumber()
+   {
+      return number;
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Generator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Generator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Generator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+ at ApplicationScoped
+public class Generator {
+   
+   private int lastInt = 0;
+   private java.util.Random random = new java.util.Random( System.currentTimeMillis() ); 
+   
+   java.util.Random getRandom()
+   {
+      return random;
+   }
+   
+   @Produces @Random int next() {
+      int nextInt = getRandom().nextInt(100);
+      while (nextInt == lastInt)
+      {
+         nextInt = getRandom().nextInt(100);
+      }
+      lastInt = nextInt;      
+      return nextInt; 
+   }
+
+} 

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import junit.framework.Assert;
+
+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 MockExampleTest 
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .alternate(MockSentenceTranslator.class)
+         .addPackage(ExampleTest.class.getPackage());
+   }
+   
+   @Test
+   public void testMockSentenceTranslator(TextTranslator tt2) throws Exception 
+   {   
+      Assert.assertEquals(
+            "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.",
+            tt2.translate("Hello world. How's tricks?") );
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockSentenceTranslator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockSentenceTranslator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockSentenceTranslator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import javax.enterprise.inject.Alternative;
+
+ at Alternative
+public class MockSentenceTranslator implements Translator { 
+   public String translate(String sentence) { 
+      return "Lorem ipsum dolor sit amet"; 
+   }
+} 

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Random.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Random.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Random.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+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/examples/SentenceParser.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/SentenceParser.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/SentenceParser.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class SentenceParser { 
+   public List<String> parse(String text) {
+      return Arrays.asList( text.split("[.?]") );
+   } 
+} 

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/SentenceTranslator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/SentenceTranslator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/SentenceTranslator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+
+public class SentenceTranslator implements Translator { 
+public String translate(String sentence) { 
+   throw new UnsupportedOperationException();
+} 
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/TextTranslator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/TextTranslator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/TextTranslator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import javax.inject.Inject;
+
+public class TextTranslator { 
+   private SentenceParser sentenceParser; 
+   private Translator sentenceTranslator; 
+   
+   @Inject
+   TextTranslator(SentenceParser sentenceParser, Translator sentenceTranslator) { 
+      this.sentenceParser = sentenceParser; 
+      this.sentenceTranslator = sentenceTranslator; 
+   }
+   
+   public String translate(String text) { 
+      StringBuilder sb = new StringBuilder(); 
+      for (String sentence: sentenceParser.parse(text)) { 
+         sb.append(sentenceTranslator.translate(sentence)).append(". "); 
+      } 
+      return sb.toString().trim(); 
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Translator.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Translator.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/Translator.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.examples;
+
+import javax.ejb.Local;
+
+ at Local 
+public interface Translator { 
+   public String translate(String sentence); 
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BaseClass.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BaseClass.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BaseClass.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class BaseClass
+{
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/BoundedGenericBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class BoundedGenericBean<T extends BaseClass>
+{
+  public T echo (T param) {
+     return param;
+  }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class GenericBean<T> implements GenericInterface<T>
+{
+
+   public T echo(T parameter)
+   {
+      return parameter;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.generic;
+
+import junit.framework.Assert;
+
+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.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at RunWith(Arquillian.class)
+public class GenericBeanTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(GenericBeanTest.class.getPackage())
+         .as(JavaArchive.class);
+   }
+
+   @Test
+   public void testGenericBean(TestBean testBean)
+   {
+      Assert.assertEquals("Hello", testBean.echo("Hello"));
+      Assert.assertEquals(Integer.valueOf(1), testBean.echo(1));
+      
+      Subclass subclassInstance = new Subclass();
+      Assert.assertSame(subclassInstance, testBean.echo(subclassInstance));
+      Assert.assertSame(subclassInstance, testBean.echo((BaseClass)subclassInstance));
+      
+      BaseClass baseInstance = new BaseClass();
+      Assert.assertSame(baseInstance, testBean.echo(baseInstance));
+   }
+
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericInterface.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericInterface.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericInterface.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface GenericInterface<T>
+{
+   T echo(T parameter);
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/Subclass.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/Subclass.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/Subclass.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class Subclass extends BaseClass
+{
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/TestBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/TestBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/TestBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.generic;
+
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class TestBean
+{
+   @Inject GenericInterface<String> genericStringField;
+
+   @Inject GenericInterface<Integer> genericIntegerField;
+
+   @Inject BoundedGenericBean<Subclass> boundedGenericSubclassField;
+
+   @Inject BoundedGenericBean<BaseClass> boundedGenericBaseField;
+
+
+   public String echo(String param)
+   {
+      return genericStringField.echo(param);
+   }
+
+   public Integer echo(Integer param)
+   {
+      return genericIntegerField.echo(param);
+   }
+
+   public Subclass echo (Subclass param)
+   {
+      return boundedGenericSubclassField.echo(param);
+   }
+
+   public BaseClass echo (BaseClass param)
+   {
+      return boundedGenericBaseField.echo(param);
+   }
+   
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.tests.managed.newBean;
+
+import java.util.Set;
+
+import javax.enterprise.inject.New;
+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.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.ManagedBean;
+import org.jboss.weld.bean.NewManagedBean;
+import org.jboss.weld.introspector.WeldAnnotated;
+import org.jboss.weld.literal.NewLiteral;
+import org.jboss.weld.util.AnnotatedTypes;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class NewSimpleBeanTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(NewSimpleBeanTest.class.getPackage())
+         .as(JavaArchive.class);
+   }
+
+   private ManagedBean<WrappedSimpleBean> wrappedSimpleBean;
+   private NewManagedBean<WrappedSimpleBean> newSimpleBean;
+   
+   private static final New NEW_LITERAL = new NewLiteral();
+   
+   @Inject
+   private BeanManager beanManager;
+   
+   public void initNewBean() {
+      
+      Assert.assertEquals(1, beanManager.getBeans(WrappedSimpleBean.class).size());
+      Assert.assertTrue(beanManager.getBeans(WrappedSimpleBean.class).iterator().next() instanceof ManagedBean);
+      wrappedSimpleBean = (ManagedBean<WrappedSimpleBean>) beanManager.getBeans(WrappedSimpleBean.class).iterator().next();
+      
+      Assert.assertEquals(1, beanManager.getBeans(WrappedSimpleBean.class, NEW_LITERAL).size());
+      Assert.assertTrue(beanManager.getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next() instanceof NewManagedBean);
+      newSimpleBean = (NewManagedBean<WrappedSimpleBean>) beanManager.getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next();
+   }
+
+   // groups = { "new" }
+   @Test
+   public void testNewBeanHasImplementationClassOfInjectionPointType()
+   {
+      initNewBean();
+      Assert.assertEquals(WrappedSimpleBean.class, newSimpleBean.getType());
+   }
+   
+   // groups = { "new" }
+   @Test
+   public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
+   {
+      initNewBean();
+      Assert.assertEquals(wrappedSimpleBean.getType(), newSimpleBean.getType());
+   }
+
+   // groups = { "new" }
+   @Test
+   public void testNewBeanHasSameConstructorAsWrappedBean()
+   {
+      initNewBean();
+      Assert.assertTrue(AnnotatedTypes.compareAnnotatedCallable(wrappedSimpleBean.getConstructor(), newSimpleBean.getConstructor()));
+   }
+
+   // groups = { "new" }
+   @Test
+   public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
+   {
+      initNewBean();
+      Assert.assertEquals(wrappedSimpleBean.getInitializerMethods(), newSimpleBean.getInitializerMethods());
+   }
+
+   // groups = { "new" }
+   @Test
+   public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
+   {
+      initNewBean();
+      Set<? extends WeldAnnotated<?, ?>> wrappedBeanInjectionPoints = wrappedSimpleBean.getWeldInjectionPoints();
+      Set<? extends WeldAnnotated<?, ?>> newBeanInjectionPoints = newSimpleBean.getWeldInjectionPoints();
+      Assert.assertEquals(wrappedBeanInjectionPoints, newBeanInjectionPoints);
+   }
+   
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/WrappedSimpleBean.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/WrappedSimpleBean.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/WrappedSimpleBean.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.managed.newBean;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+ at SessionScoped
+class WrappedSimpleBean implements Serializable
+{
+   public WrappedSimpleBean() {
+      
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.nonContextual;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+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.metadata.validation.ValidationException;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class ExampleTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addClasses(External.class, WebBean.class)
+         .as(JavaArchive.class);
+   }
+   
+   @Inject
+   private BeanManager beanManager;
+   
+   @Test
+   public void testNonContextual() throws Exception 
+   {
+      NonContextual<External> nonContextual = new NonContextual<External>(beanManager, External.class);
+      
+      External external = new External();
+      Assert.assertNull(external.bean);
+      nonContextual.postConstruct(external);
+      Assert.assertNotNull(external.bean);
+      nonContextual.preDestroy(external);
+      // preDestroy doesn't cause any dis-injection
+      Assert.assertNotNull(external.bean);      
+   }
+   
+   @Test
+   public void validateNonContextual() throws Exception
+   {
+      NonContextual<External> nonContextual = new NonContextual<External>(beanManager, External.class);
+
+      for (InjectionPoint point : nonContextual.it.getInjectionPoints())
+      {
+         try
+         {
+            beanManager.validate(point);
+         }
+         catch(ValidationException e)
+         {
+            Assert.fail("Should have been valid");
+         }
+      }
+   }
+   
+   
+   public class NonContextual<T> {
+
+      final InjectionTarget<T> it;
+      final BeanManager manager;
+
+      public NonContextual(BeanManager manager, Class<T> clazz) {
+         this.manager = manager;
+         AnnotatedType<T> type = manager.createAnnotatedType(clazz);
+         this.it = manager.createInjectionTarget(type);
+      }
+
+      public CreationalContext<T> postConstruct(T instance) {
+         CreationalContext<T> cc = manager.createCreationalContext(null);
+         it.inject(instance, cc);
+         it.postConstruct(instance);
+         return cc;
+      }
+
+      public void preDestroy(T instance) {
+         it.preDestroy(instance);
+      }
+   }
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/External.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/External.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/External.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.nonContextual;
+
+import javax.inject.Inject;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class External
+{
+   
+   public External()
+   {
+      // TODO Auto-generated constructor stub
+   }
+   
+   @Inject WebBean bean;
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/LogManager.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/LogManager.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/LogManager.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.nonContextual;
+
+import java.util.logging.Logger;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class LogManager
+{
+
+   @Produces
+   public Logger createLogger(InjectionPoint injectionPoint)
+   {
+      return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/Random.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/Random.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/Random.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.nonContextual;
+
+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/nonContextual/ServletContextListenerImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletContextListenerImpl.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletContextListenerImpl.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.nonContextual;
+
+import java.util.logging.Logger;
+
+import javax.inject.Inject;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class ServletContextListenerImpl implements ServletContextListener
+{
+   
+   public static boolean ok;
+   
+   @Inject Logger log;
+
+   public void contextDestroyed(ServletContextEvent sce)
+   {
+      
+   }
+
+   public void contextInitialized(ServletContextEvent sce)
+   {
+      log.finer("hello!");
+      ok = true;
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.nonContextual;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+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 ServletListenerTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.war", WebArchive.class)
+         .addClasses(ServletContextListenerImpl.class, LogManager.class)
+         .addWebResource(
+               ServletListenerTest.class.getPackage(), "web.xml", ArchivePaths.create("web.xml"))
+         .addWebResource(
+               new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
+      
+   }
+
+   /**
+    * description="WELD-445"
+    */
+   @Test
+   public void test()
+   {
+      Assert.assertTrue(ServletContextListenerImpl.ok);
+   }
+}

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

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.specialization;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import junit.framework.Assert;
+
+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.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class SpecializationTest
+{
+   @Deployment
+   public static Archive<?> deploy() 
+   {
+      return ShrinkWrap.create("test.jar", BeanArchive.class)
+         .addPackage(SpecializationTest.class.getPackage())
+         .as(JavaArchive.class);
+   }
+   
+   @Inject
+   private BeanManager beanManager;
+   
+   /**
+    * WELD-321
+    */
+   @Test
+   public void testSpecialization()
+   {
+      Assert.assertEquals(User2.class, beanManager.resolve(beanManager.getBeans(User.class)).getBeanClass());
+   }
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.specialization;
+
+public class User
+{
+
+}

Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User2.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User2.java	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/User2.java	2010-06-11 18:54:33 UTC (rev 6422)
@@ -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.specialization;
+
+import javax.enterprise.inject.Specializes;
+
+ at Specializes
+public class User2 extends User
+{
+}
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1 @@
+org.jboss.weld.tests.CategoryArchiveAppender
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/jndi.properties
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/jndi.properties	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/jndi.properties	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,4 @@
+#jboss JNDI properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,5 @@
+<beans>
+   <decorators>
+      <decorator>org.jboss.weld.tests.decorators.custom.CustomWindowFrame</decorator>
+   </decorators>
+</beans>

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,24 @@
+<!--
+  ~ JBoss, Home of Professional Open Source
+  ~ Copyright <Year>, 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.
+  -->
+
+<beans>
+   <decorators>
+      <decorator>org.jboss.weld.tests.decorators.custom.OuterWindowFrame</decorator>
+      <decorator>org.jboss.weld.tests.decorators.custom.CustomWindowFrame</decorator>
+      <decorator>org.jboss.weld.tests.decorators.custom.InnerWindowFrame</decorator>
+   </decorators>
+</beans>

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1 @@
+org.jboss.weld.tests.decorators.custom.CustomDecoratorDeploymentObserver

Added: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/nonContextual/web.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/nonContextual/web.xml	                        (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/nonContextual/web.xml	2010-06-11 18:54:33 UTC (rev 6422)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+    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/web-app_2_5.xsd">
+   
+   <display-name>Weld Core Tests - nonContextual</display-name>
+   
+   <listener>
+      <listener-class>org.jboss.weld.tests.nonContextual.ServletContextListenerImpl</listener-class>
+   </listener>
+
+</web-app>



More information about the weld-commits mailing list