From weld-commits at lists.jboss.org Tue Aug 3 06:51:24 2010 Content-Type: multipart/mixed; boundary="===============7108502532533713221==" MIME-Version: 1.0 From: weld-commits at lists.jboss.org To: weld-commits at lists.jboss.org Subject: [weld-commits] Weld SVN: r6876 - in core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators: genericobserver and 1 other directory. Date: Tue, 03 Aug 2010 06:51:24 -0400 Message-ID: <201008031051.o73ApOQQ000372@svn01.web.mwc.hst.phx2.redhat.com> --===============7108502532533713221== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: aslak Date: 2010-08-03 06:51:24 -0400 (Tue, 03 Aug 2010) New Revision: 6876 Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorator= s/genericobserver/ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorator= s/genericobserver/DecorateGenericObserverTest.java core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorator= s/genericobserver/Dog.java core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorator= s/genericobserver/Service.java core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorator= s/genericobserver/ServiceDecorator.java core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorator= s/genericobserver/ServiceImpl.java Log: WELD-579 Test case to expose error, marked as Broken Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decor= ators/genericobserver/DecorateGenericObserverTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/DecorateGenericObserverTest.java = (rev 0) +++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/DecorateGenericObserverTest.java 2010-08-03 10:51:24 UTC= (rev 6876) @@ -0,0 +1,73 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, Red Hat, Inc., and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.weld.tests.decorators.genericobserver; + +import javax.enterprise.event.Event; +import javax.inject.Inject; + +import org.jboss.arquillian.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.BeanArchive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.weld.tests.category.Broken; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +/** + * = + * 5.5.6: "Invoke the observer method on the resulting instance, if any, = as a business method invocation, = + * as defined in Section 7.2, =E2=80=9CContainer invocations and interc= eption=E2=80=9D. + * = + * 7.2 : "Invocations of producer, disposer and observer methods by the = container are business method invocations = + * and are intercepted by method interceptors and decorators." + * = + * @author Aslak Knutsen + * + */ +(a)RunWith(Arquillian.class) +public class DecorateGenericObserverTest +{ + @Deployment + public static Archive deploy() + { + return ShrinkWrap.create(BeanArchive.class) + .decorate(ServiceDecorator.class) + .addPackage(DecorateGenericObserverTest.class.getPackage= ()); + } + + @Inject + private Event dogEvent; + + /* + * description =3D "WELD-579" + */ + @Category(Broken.class) + @Test + public void shouldInvokeDecoratorsWhenObservingGenericEvents() + { + ServiceImpl.invocationCount =3D 0; + ServiceDecorator.invocationCount =3D 0; + = + dogEvent.fire(new Dog()); + = + Assert.assertEquals(1, ServiceImpl.invocationCount); + Assert.assertEquals(1, ServiceDecorator.invocationCount); + } +} \ No newline at end of file Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decor= ators/genericobserver/Dog.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/Dog.java (rev 0) +++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/Dog.java 2010-08-03 10:51:24 UTC (rev 6876) @@ -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.genericobserver; + +/** + * Dog + * + * @author Aslak Knutsen + * @version $Revision: $ + */ +public class Dog { + +} Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decor= ators/genericobserver/Service.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/Service.java (rev 0) +++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/Service.java 2010-08-03 10:51:24 UTC (rev 6876) @@ -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.decorators.genericobserver; + +/** + * Service + * + * @author Aslak Knutsen + * @version $Revision: $ + * @param + */ +public interface Service = +{ + void on(T dog); +} \ No newline at end of file Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decor= ators/genericobserver/ServiceDecorator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/ServiceDecorator.java (rev 0) +++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/ServiceDecorator.java 2010-08-03 10:51:24 UTC (rev 6876) @@ -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. + */ + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package org.jboss.weld.tests.decorators.genericobserver; + +import javax.decorator.Decorator; +import javax.decorator.Delegate; +import javax.inject.Inject; + +/** + * ServiceDecorator + * + * @author Aslak Knutsen + * @version $Revision: $ + */ +(a)Decorator +public class ServiceDecorator implements Service +{ + @Inject @Delegate + private Service service; + + public static int invocationCount =3D 0; + + public void on(Dog dog) + { + invocationCount++; + service.on(dog); + } +} \ No newline at end of file Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decor= ators/genericobserver/ServiceImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/ServiceImpl.java (rev 0) +++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorato= rs/genericobserver/ServiceImpl.java 2010-08-03 10:51:24 UTC (rev 6876) @@ -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.genericobserver; + +import javax.enterprise.event.Observes; + +/** + * ServiceImpl + * + * @author Aslak Knutsen + * @version $Revision: $ + */ +public class ServiceImpl implements Service = +{ + public static int invocationCount =3D 0; + + public void on(@Observes Dog dog) = + { + invocationCount++; + } +} \ No newline at end of file --===============7108502532533713221==--