Author: marius.bogoevici
Date: 2010-07-22 12:40:17 -0400 (Thu, 22 Jul 2010)
New Revision: 6754
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml
Log:
Tests for WELD-568
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java 2010-07-22
16:40:17 UTC (rev 6754)
@@ -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.interceptors.hierarchical;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Play
+public class Attacker extends Player
+{
+
+ public void playBall()
+ {
+ // do nothing
+ }
+
+
+ public Attacker cloneMe()
+ {
+ return this;
+ }
+}
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Defender.java 2010-07-22
16:40:17 UTC (rev 6754)
@@ -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.interceptors.hierarchical;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Interceptor @Play
+public class Defender
+{
+ static int invocationsCount = 0;
+
+ @AroundInvoke
+ public Object tackle(InvocationContext invocationContext) throws Exception
+ {
+ invocationsCount ++;
+ return invocationContext.proceed();
+ }
+}
\ No newline at end of file
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/InterceptorsWithHierarchyTest.java 2010-07-22
16:40:17 UTC (rev 6754)
@@ -0,0 +1,30 @@
+package org.jboss.weld.tests.interceptors.hierarchical;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Artifact
+(a)BeansXml("beans.xml")
+public class InterceptorsWithHierarchyTest extends AbstractWeldTest
+{
+ @BeforeClass
+ public static void initialize()
+ {
+ Defender.invocationsCount = 0;
+ }
+
+ @Test(groups = "broken")
+ public void testInterceptorsWithHierarchy()
+ {
+ Attacker player = this.getReference(Attacker.class);
+ player.cloneMe();
+ assert Defender.invocationsCount == 1;
+ }
+
+}
Copied:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java
(from rev 6741,
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/ejb/Pass.java)
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java 2010-07-22
16:40:17 UTC (rev 6754)
@@ -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.interceptors.hierarchical;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius
Bogoevici</a>
+ */
+@InterceptorBinding
+@Retention(RUNTIME)
+(a)Target({ElementType.METHOD, ElementType.TYPE})
+@Documented
+public @interface Play
+{
+}
\ No newline at end of file
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Play.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java 2010-07-22
16:40:17 UTC (rev 6754)
@@ -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.interceptors.hierarchical;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class Player
+{
+ public void playBall()
+ {
+
+ }
+
+ public Player cloneMe()
+ {
+ return this;
+ }
+}
Copied:
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml
(from rev 6741,
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/ejb/beans.xml)
===================================================================
---
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml
(rev 0)
+++
core/trunk/tests/src/test/resources/org/jboss/weld/tests/interceptors/hierarchical/beans.xml 2010-07-22
16:40:17 UTC (rev 6754)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.weld.tests.interceptors.hierarchical.Defender</class>
+ </interceptors>
+</beans>