Repository: deltaspike Updated Branches: refs/heads/master dfe5676a9 -> 818dabe09
DELTASPIKE-1069 evaluate interceptors for producer-methods Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/818dabe0 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/818dabe0 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/818dabe0 Branch: refs/heads/master Commit: 818dabe09572f973f3bbb3cd42b0bedacdb1b4e0 Parents: dfe5676 Author: Thomas Andraschko <[email protected]> Authored: Mon Mar 21 23:32:02 2016 +0100 Committer: Thomas Andraschko <[email protected]> Committed: Mon Mar 21 23:32:02 2016 +0100 ---------------------------------------------------------------------- .../proxy/api/DeltaSpikeProxyFactory.java | 2 +- .../proxy/api/EnableBeanInterceptors.java | 37 ---------- .../proxy/api/EnableInterceptors.java | 37 ++++++++++ .../spi/EnableBeanInterceptorsInterceptor.java | 52 -------------- .../spi/EnableBeanInterceptorsProxyFactory.java | 45 ------------ .../proxy/spi/EnableInterceptorsDelegate.java | 39 +++++++++++ .../spi/EnableInterceptorsInterceptor.java | 55 +++++++++++++++ .../spi/EnableInterceptorsProxyFactory.java | 68 ++++++++++++++++++ .../api/src/main/resources/META-INF/beans.xml | 2 +- .../EnableBeanInterceptorsTest.java | 73 -------------------- ...eanInterceptors_WithoutInterceptor_Test.java | 66 ------------------ .../impl/enablebeaninterceptors/MyBean.java | 55 --------------- .../MyBeanInterceptor.java | 37 ---------- .../MyBeanInterceptorBinding.java | 37 ---------- .../enablebeaninterceptors/MyBeanProducer.java | 32 --------- .../EnableInterceptorsTest.java | 73 ++++++++++++++++++++ ...bleInterceptors_WithoutInterceptor_Test.java | 66 ++++++++++++++++++ .../proxy/impl/enableinterceptors/MyBean.java | 55 +++++++++++++++ .../enableinterceptors/MyBeanInterceptor.java | 37 ++++++++++ .../MyBeanInterceptorBinding.java | 37 ++++++++++ .../impl/enableinterceptors/MyBeanProducer.java | 33 +++++++++ 21 files changed, 502 insertions(+), 436 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java index fc2cc2d..e2db0e3 100644 --- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java +++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java @@ -118,7 +118,7 @@ public abstract class DeltaSpikeProxyFactory ArrayList<Method> delegateMethods = getDelegateMethods(targetClass, allMethods); // check if a interceptor is defined on class level. if not, skip interceptor methods - if (delegateMethods != null + if (interceptMethods != null && interceptMethods.size() > 0 && !containsInterceptorBinding(beanManager, targetClass.getDeclaredAnnotations())) { http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableBeanInterceptors.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableBeanInterceptors.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableBeanInterceptors.java deleted file mode 100644 index 94122d0..0000000 --- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableBeanInterceptors.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.api; - -import java.lang.annotation.Documented; -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; - -@InterceptorBinding -@Documented -@Inherited -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE, ElementType.METHOD }) -public @interface EnableBeanInterceptors -{ - -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableInterceptors.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableInterceptors.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableInterceptors.java new file mode 100644 index 0000000..5ed861b --- /dev/null +++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/EnableInterceptors.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.api; + +import java.lang.annotation.Documented; +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; + +@InterceptorBinding +@Documented +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.TYPE, ElementType.METHOD }) +public @interface EnableInterceptors +{ + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsInterceptor.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsInterceptor.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsInterceptor.java deleted file mode 100644 index 28c9285..0000000 --- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsInterceptor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.spi; - -import java.io.Serializable; -import javax.enterprise.inject.spi.BeanManager; -import javax.inject.Inject; -import javax.interceptor.AroundInvoke; -import javax.interceptor.Interceptor; -import javax.interceptor.InvocationContext; -import org.apache.deltaspike.proxy.api.EnableBeanInterceptors; - -@Interceptor -@EnableBeanInterceptors -public class EnableBeanInterceptorsInterceptor implements Serializable -{ - @Inject - private BeanManager beanManager; - - @AroundInvoke - public Object wrapBeanCandidate(InvocationContext invocationContext) throws Exception - { - Object beanCandidate = invocationContext.proceed(); - - if (beanCandidate == null) - { - throw new IllegalStateException("Can not apply " - + EnableBeanInterceptors.class.getSimpleName() - + " on a null instance!"); - } - - Class proxy = EnableBeanInterceptorsProxyFactory.getInstance().getProxyClass(beanManager, - beanCandidate.getClass()); - return proxy.newInstance(); - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsProxyFactory.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsProxyFactory.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsProxyFactory.java deleted file mode 100644 index d3a68aa..0000000 --- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableBeanInterceptorsProxyFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.spi; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory; - -public class EnableBeanInterceptorsProxyFactory extends DeltaSpikeProxyFactory -{ - private static final EnableBeanInterceptorsProxyFactory INSTANCE = new EnableBeanInterceptorsProxyFactory(); - - public static EnableBeanInterceptorsProxyFactory getInstance() - { - return INSTANCE; - } - - @Override - protected ArrayList<Method> getDelegateMethods(Class<?> targetClass, ArrayList<Method> allMethods) - { - return null; - } - - @Override - protected String getProxyClassSuffix() - { - return "$$DSBeanInterceptorProxy"; - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsDelegate.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsDelegate.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsDelegate.java new file mode 100644 index 0000000..c3323e2 --- /dev/null +++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsDelegate.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.spi; + +import java.io.Serializable; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; + +public class EnableInterceptorsDelegate implements InvocationHandler, Serializable +{ + private final Object instance; + + public EnableInterceptorsDelegate(Object instance) + { + this.instance = instance; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + { + return method.invoke(instance, args); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsInterceptor.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsInterceptor.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsInterceptor.java new file mode 100644 index 0000000..3c124a4 --- /dev/null +++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsInterceptor.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.spi; + +import java.io.Serializable; +import java.lang.reflect.Constructor; +import javax.enterprise.inject.spi.BeanManager; +import javax.inject.Inject; +import javax.interceptor.AroundInvoke; +import javax.interceptor.Interceptor; +import javax.interceptor.InvocationContext; +import org.apache.deltaspike.proxy.api.EnableInterceptors; + +@Interceptor +@EnableInterceptors +public class EnableInterceptorsInterceptor implements Serializable +{ + @Inject + private BeanManager beanManager; + + @AroundInvoke + public Object wrapBeanCandidate(InvocationContext invocationContext) throws Exception + { + Object beanCandidate = invocationContext.proceed(); + + if (beanCandidate == null) + { + throw new IllegalStateException("Can not apply " + + EnableInterceptors.class.getSimpleName() + + " on a null instance!"); + } + + Class proxyClass = EnableInterceptorsProxyFactory.getInstance().getProxyClass(beanManager, + beanCandidate.getClass(), EnableInterceptorsDelegate.class); + + Constructor constructor = proxyClass.getConstructor(EnableInterceptorsDelegate.class); + return constructor.newInstance(new EnableInterceptorsDelegate(beanCandidate)); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsProxyFactory.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsProxyFactory.java b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsProxyFactory.java new file mode 100644 index 0000000..1de27a0 --- /dev/null +++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/spi/EnableInterceptorsProxyFactory.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.spi; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Iterator; +import org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory; + +public class EnableInterceptorsProxyFactory extends DeltaSpikeProxyFactory +{ + private static final EnableInterceptorsProxyFactory INSTANCE = new EnableInterceptorsProxyFactory(); + + public static EnableInterceptorsProxyFactory getInstance() + { + return INSTANCE; + } + + @Override + protected ArrayList<Method> getDelegateMethods(Class<?> targetClass, ArrayList<Method> allMethods) + { + ArrayList<Method> methods = new ArrayList<Method>(); + + Iterator<Method> it = allMethods.iterator(); + while (it.hasNext()) + { + Method method = it.next(); + + if (Modifier.isPublic(method.getModifiers()) + && !Modifier.isFinal(method.getModifiers()) + && !Modifier.isAbstract(method.getModifiers())) + { + methods.add(method); + } + } + + return methods; + } + + @Override + protected ArrayList<Method> filterInterceptMethods(Class<?> targetClass, ArrayList<Method> allMethods) + { + return null; + } + + @Override + protected String getProxyClassSuffix() + { + return "$$DSInterceptorProxy"; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/api/src/main/resources/META-INF/beans.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/api/src/main/resources/META-INF/beans.xml b/deltaspike/modules/proxy/api/src/main/resources/META-INF/beans.xml index 2eecf4c..682d4c9 100644 --- a/deltaspike/modules/proxy/api/src/main/resources/META-INF/beans.xml +++ b/deltaspike/modules/proxy/api/src/main/resources/META-INF/beans.xml @@ -21,6 +21,6 @@ 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/beans_1_0.xsd"> <interceptors> - <class>org.apache.deltaspike.proxy.spi.EnableBeanInterceptorsInterceptor</class> + <class>org.apache.deltaspike.proxy.spi.EnableInterceptorsInterceptor</class> </interceptors> </beans> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptorsTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptorsTest.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptorsTest.java deleted file mode 100644 index 553c869..0000000 --- a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptorsTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.impl.enablebeaninterceptors; - -import javax.inject.Inject; -import org.apache.deltaspike.test.proxy.impl.util.ArchiveUtils; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.Asset; -import org.jboss.shrinkwrap.api.asset.StringAsset; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(Arquillian.class) -public class EnableBeanInterceptorsTest -{ - @Deployment - public static WebArchive war() - { - Asset beansXml = new StringAsset( - "<beans><interceptors><class>" + - MyBeanInterceptor.class.getName() + - "</class></interceptors></beans>" - ); - - String simpleName = EnableBeanInterceptorsTest.class.getSimpleName(); - String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); - - JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") - .addPackage(EnableBeanInterceptorsTest.class.getPackage()) - .addAsManifestResource(beansXml, "beans.xml"); - - return ShrinkWrap.create(WebArchive.class, archiveName + ".war") - .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive()) - .addAsLibraries(testJar) - .addAsWebInfResource(beansXml, "beans.xml"); - } - - @Inject - private MyBean myBean; - - @Test - public void testPartialBeanWithApplicationScope() throws Exception - { - Assert.assertFalse(myBean.isIntercepted()); - Assert.assertFalse(myBean.isMethodCalled()); - - myBean.somethingIntercepted(); - - Assert.assertTrue(myBean.isIntercepted()); - Assert.assertTrue(myBean.isMethodCalled()); - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptors_WithoutInterceptor_Test.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptors_WithoutInterceptor_Test.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptors_WithoutInterceptor_Test.java deleted file mode 100644 index 42ea1f5..0000000 --- a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/EnableBeanInterceptors_WithoutInterceptor_Test.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.impl.enablebeaninterceptors; - -import javax.inject.Inject; -import org.apache.deltaspike.test.proxy.impl.util.ArchiveUtils; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.EmptyAsset; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(Arquillian.class) -public class EnableBeanInterceptors_WithoutInterceptor_Test -{ - @Deployment - public static WebArchive war() - { - String simpleName = EnableBeanInterceptors_WithoutInterceptor_Test.class.getSimpleName(); - String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); - - JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") - .addPackage(EnableBeanInterceptors_WithoutInterceptor_Test.class.getPackage()) - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); - - return ShrinkWrap.create(WebArchive.class, archiveName + ".war") - .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive()) - .addAsLibraries(testJar) - .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); - } - - @Inject - private MyBean myBean; - - @Test - public void testPartialBeanWithApplicationScope() throws Exception - { - Assert.assertFalse(myBean.isIntercepted()); - Assert.assertFalse(myBean.isMethodCalled()); - - myBean.somethingIntercepted(); - - Assert.assertFalse(myBean.isIntercepted()); - Assert.assertTrue(myBean.isMethodCalled()); - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBean.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBean.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBean.java deleted file mode 100644 index 65969a4..0000000 --- a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBean.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.impl.enablebeaninterceptors; - -import org.apache.deltaspike.core.api.exclude.Exclude; - -@Exclude -public class MyBean -{ - private boolean intercepted; - private boolean methodCalled; - - public boolean isIntercepted() - { - return intercepted; - } - - public void setIntercepted(boolean intercepted) - { - this.intercepted = intercepted; - } - - public boolean isMethodCalled() - { - return methodCalled; - } - - public void setMethodCalled(boolean methodCalled) - { - this.methodCalled = methodCalled; - } - - - @MyBeanInterceptorBinding - public void somethingIntercepted() - { - methodCalled = true; - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptor.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptor.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptor.java deleted file mode 100644 index 74fe9d9..0000000 --- a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptor.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.impl.enablebeaninterceptors; - -import java.io.Serializable; -import javax.interceptor.AroundInvoke; -import javax.interceptor.Interceptor; -import javax.interceptor.InvocationContext; - -@Interceptor -@MyBeanInterceptorBinding -public class MyBeanInterceptor implements Serializable -{ - @AroundInvoke - public Object wrapBeanCandidate(InvocationContext invocationContext) throws Exception - { - ((MyBean) invocationContext.getTarget()).setIntercepted(true); - - return invocationContext.proceed(); - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptorBinding.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptorBinding.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptorBinding.java deleted file mode 100644 index 5e54ea1..0000000 --- a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanInterceptorBinding.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.impl.enablebeaninterceptors; - -import java.lang.annotation.Documented; -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; - -@InterceptorBinding -@Documented -@Inherited -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE, ElementType.METHOD }) -public @interface MyBeanInterceptorBinding -{ - -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanProducer.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanProducer.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanProducer.java deleted file mode 100644 index 1903a7a..0000000 --- a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enablebeaninterceptors/MyBeanProducer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.proxy.impl.enablebeaninterceptors; - -import javax.enterprise.inject.Produces; -import org.apache.deltaspike.proxy.api.EnableBeanInterceptors; - -public class MyBeanProducer -{ - @Produces - @EnableBeanInterceptors - public MyBean produce() - { - return new MyBean(); - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java new file mode 100644 index 0000000..db3c258 --- /dev/null +++ b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.impl.enableinterceptors; + +import javax.inject.Inject; +import org.apache.deltaspike.test.proxy.impl.util.ArchiveUtils; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.StringAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class EnableInterceptorsTest +{ + @Deployment + public static WebArchive war() + { + Asset beansXml = new StringAsset( + "<beans><interceptors><class>" + + MyBeanInterceptor.class.getName() + + "</class></interceptors></beans>" + ); + + String simpleName = EnableInterceptorsTest.class.getSimpleName(); + String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); + + JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") + .addPackage(EnableInterceptorsTest.class.getPackage()) + .addAsManifestResource(beansXml, "beans.xml"); + + return ShrinkWrap.create(WebArchive.class, archiveName + ".war") + .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive()) + .addAsLibraries(testJar) + .addAsWebInfResource(beansXml, "beans.xml"); + } + + @Inject + private MyBean myBean; + + @Test + public void testPartialBeanWithApplicationScope() throws Exception + { + Assert.assertFalse(myBean.isIntercepted()); + Assert.assertFalse(myBean.isMethodCalled()); + + myBean.somethingIntercepted(); + + Assert.assertTrue(myBean.isIntercepted()); + Assert.assertTrue(myBean.isMethodCalled()); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptors_WithoutInterceptor_Test.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptors_WithoutInterceptor_Test.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptors_WithoutInterceptor_Test.java new file mode 100644 index 0000000..de26499 --- /dev/null +++ b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptors_WithoutInterceptor_Test.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.impl.enableinterceptors; + +import javax.inject.Inject; +import org.apache.deltaspike.test.proxy.impl.util.ArchiveUtils; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class EnableInterceptors_WithoutInterceptor_Test +{ + @Deployment + public static WebArchive war() + { + String simpleName = EnableInterceptors_WithoutInterceptor_Test.class.getSimpleName(); + String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); + + JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") + .addPackage(EnableInterceptors_WithoutInterceptor_Test.class.getPackage()) + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + + return ShrinkWrap.create(WebArchive.class, archiveName + ".war") + .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive()) + .addAsLibraries(testJar) + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); + } + + @Inject + private MyBean myBean; + + @Test + public void testPartialBeanWithApplicationScope() throws Exception + { + Assert.assertFalse(myBean.isIntercepted()); + Assert.assertFalse(myBean.isMethodCalled()); + + myBean.somethingIntercepted(); + + Assert.assertFalse(myBean.isIntercepted()); + Assert.assertTrue(myBean.isMethodCalled()); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBean.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBean.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBean.java new file mode 100644 index 0000000..4c2373e --- /dev/null +++ b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBean.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.impl.enableinterceptors; + +import org.apache.deltaspike.core.api.exclude.Exclude; + +@Exclude +public class MyBean +{ + private boolean intercepted; + private boolean methodCalled; + + public boolean isIntercepted() + { + return intercepted; + } + + public void setIntercepted(boolean intercepted) + { + this.intercepted = intercepted; + } + + public boolean isMethodCalled() + { + return methodCalled; + } + + public void setMethodCalled(boolean methodCalled) + { + this.methodCalled = methodCalled; + } + + + @MyBeanInterceptorBinding + public void somethingIntercepted() + { + methodCalled = true; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptor.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptor.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptor.java new file mode 100644 index 0000000..edf53af --- /dev/null +++ b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptor.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.impl.enableinterceptors; + +import java.io.Serializable; +import javax.interceptor.AroundInvoke; +import javax.interceptor.Interceptor; +import javax.interceptor.InvocationContext; + +@Interceptor +@MyBeanInterceptorBinding +public class MyBeanInterceptor implements Serializable +{ + @AroundInvoke + public Object wrapBeanCandidate(InvocationContext invocationContext) throws Exception + { + ((MyBean) invocationContext.getTarget()).setIntercepted(true); + + return invocationContext.proceed(); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptorBinding.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptorBinding.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptorBinding.java new file mode 100644 index 0000000..77fa1c8 --- /dev/null +++ b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptorBinding.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.impl.enableinterceptors; + +import java.lang.annotation.Documented; +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; + +@InterceptorBinding +@Documented +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.TYPE, ElementType.METHOD }) +public @interface MyBeanInterceptorBinding +{ + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/818dabe0/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanProducer.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanProducer.java b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanProducer.java new file mode 100644 index 0000000..4344222 --- /dev/null +++ b/deltaspike/modules/proxy/impl-asm5/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanProducer.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.proxy.impl.enableinterceptors; + +import javax.enterprise.inject.Produces; +import org.apache.deltaspike.proxy.api.EnableInterceptors; + +public class MyBeanProducer +{ + @Produces + @EnableInterceptors + public MyBean produce() + { + MyBean myBean = new MyBean(); + return myBean; + } +}
