Author: tandraschko
Date: Tue Mar 12 13:27:19 2019
New Revision: 1855319
URL: http://svn.apache.org/viewvc?rev=1855319&view=rev
Log:
OWB-1259
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/InterceptionFactoryOnInterfacesTest.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/UnproxyableClassWithInterfaceFactoryTest.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterceptionFactoryBeansProducer.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithInterceptors.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithoutInterceptors.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/Secure2Interceptor.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/TransactionalInterceptor.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClass.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassInterface.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassProducer.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1855319&r1=1855318&r2=1855319&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Tue Mar 12 13:27:19 2019
@@ -206,15 +206,17 @@ public class InterceptorResolutionServic
List<Interceptor<?>> cdiInterceptors = new
ArrayList<>(allUsedCdiInterceptors);
Collections.sort(cdiInterceptors, new
InterceptorComparator(webBeansContext));
- List<Interceptor<?>> cdiConstructorInterceptors = new
ArrayList<>(allUsedConstructorCdiInterceptors);
- Collections.sort(cdiConstructorInterceptors, new
InterceptorComparator(webBeansContext));
-
- boolean interceptedBean = allUsedEjbInterceptors.size() > 0 ||
- allUsedCdiInterceptors.size() > 0 ||
- lifecycleMethodInterceptorInfos.size() > 0;
-
- if ((interceptedBean || decorators.size() > 0) &&
Modifier.isFinal(annotatedType.getJavaClass().getModifiers()))
- {
+ List<Interceptor<?>> cdiConstructorInterceptors = new
ArrayList<>(allUsedConstructorCdiInterceptors);
+ Collections.sort(cdiConstructorInterceptors, new
InterceptorComparator(webBeansContext));
+
+ boolean interceptedBean = !annotatedType.getJavaClass().isInterface()
&& (
+ allUsedEjbInterceptors.size() > 0 ||
+ allUsedCdiInterceptors.size() > 0 ||
+ lifecycleMethodInterceptorInfos.size() > 0
+ );
+
+ if ((interceptedBean || decorators.size() > 0) &&
Modifier.isFinal(annotatedType.getJavaClass().getModifiers()))
+ {
throw new WebBeansDeploymentException("Cannot apply Decorators or
Interceptors on a final class: "
+
annotatedType.getJavaClass().getName());
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java?rev=1855319&r1=1855318&r2=1855319&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
Tue Mar 12 13:27:19 2019
@@ -130,13 +130,13 @@ public abstract class AbstractProducer<T
Map<Interceptor<?>, Object> interceptorInstances =
creationalContextImpl.getWebBeansContext()
.getInterceptorResolutionService().createInterceptorInstances(interceptorInfo,
creationalContextImpl);
creationalContextImpl.putContextual(oldContextual);
-
- T instance = produce(interceptorInstances, creationalContextImpl);
-
- if (hasInterceptorInfo())
- {
- instance =
creationalContextImpl.getWebBeansContext().getInterceptorResolutionService()
- .createProxiedInstance(instance, creationalContextImpl,
creationalContext,
+
+ T instance = produce(interceptorInstances, creationalContextImpl);
+
+ if (hasInterceptorInfo() && !(instance instanceof OwbInterceptorProxy))
+ {
+ instance =
creationalContextImpl.getWebBeansContext().getInterceptorResolutionService()
+ .createProxiedInstance(instance, creationalContextImpl,
creationalContext,
interceptorInfo, proxyClass, methodInterceptors,
passivationId, interceptorInstances,
this::isDelegateInjection, this::filterDecorators);
creationalContextImpl.putContextual(oldContextual);
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/InterceptionFactoryOnInterfacesTest.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/InterceptionFactoryOnInterfacesTest.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/InterceptionFactoryOnInterfacesTest.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/InterceptionFactoryOnInterfacesTest.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,76 @@
+/*
+ * 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.webbeans.test.interceptors.factory;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import
org.apache.webbeans.test.interceptors.factory.beans.InterceptionFactoryBeansProducer;
+import
org.apache.webbeans.test.interceptors.factory.beans.InterfaceWithInterceptors;
+import
org.apache.webbeans.test.interceptors.factory.beans.InterfaceWithoutInterceptors;
+import org.apache.webbeans.test.interceptors.factory.beans.Secure2Interceptor;
+import
org.apache.webbeans.test.interceptors.factory.beans.TransactionalInterceptor;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InterceptionFactoryOnInterfacesTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testNoInterceptorOnTheInterface() throws Exception
+ {
+ startContainer(InterceptionFactoryBeansProducer.class);
+ InterfaceWithoutInterceptors instance =
getInstance("noInterceptorOnTheInterface");
+ Assert.assertEquals("dummy", instance.getName()); // regular method
+ Assert.assertEquals("John Doe", instance.getDefaultName()); // default
method
+ shutDownContainer();
+ }
+
+ @Test
+ public void testInterceptorsOnTheInterface() throws Exception
+ {
+ addInterceptor(TransactionalInterceptor.class);
+ startContainer(InterceptionFactoryBeansProducer.class);
+ InterfaceWithInterceptors instance =
getInstance("interceptorsOnTheInterface");
+ Assert.assertEquals("intercepted dummy", instance.getName()); //
regular method
+ Assert.assertEquals("intercepted John Doe", instance.getDefaultName());
// default method
+ shutDownContainer();
+ }
+
+ @Test
+ public void
testNoInterceptorOnTheInterfacePlusProgrammaticallyAddedBindings() throws
Exception
+ {
+ addInterceptor(TransactionalInterceptor.class);
+ startContainer(InterceptionFactoryBeansProducer.class);
+ InterfaceWithoutInterceptors instance =
getInstance("noInterceptorOnTheInterfacePlusProgrammaticallyAddedBindings");
+ Assert.assertEquals("intercepted dummy", instance.getName()); //
regular method
+ Assert.assertEquals("intercepted John Doe", instance.getDefaultName());
// default method
+ shutDownContainer();
+ }
+
+ @Test
+ public void
testInterceptorsOnTheInterfacePlusProgrammaticallyAddedBindings() throws
Exception
+ {
+ addInterceptor(TransactionalInterceptor.class);
+ addInterceptor(Secure2Interceptor.class);
+ startContainer(InterceptionFactoryBeansProducer.class);
+ InterfaceWithInterceptors instance =
getInstance("interceptorsOnTheInterfacePlusProgrammaticallyAddedBindings");
+ Assert.assertEquals("intercepted dummy secured", instance.getName());
// regular method
+ Assert.assertEquals("intercepted John Doe secured",
instance.getDefaultName()); // default method
+ shutDownContainer();
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/UnproxyableClassWithInterfaceFactoryTest.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/UnproxyableClassWithInterfaceFactoryTest.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/UnproxyableClassWithInterfaceFactoryTest.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/UnproxyableClassWithInterfaceFactoryTest.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,40 @@
+/*
+ * 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.webbeans.test.interceptors.factory;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import
org.apache.webbeans.test.interceptors.factory.beans.TransactionalInterceptor;
+import
org.apache.webbeans.test.interceptors.factory.beans.UnproxyableClassInterface;
+import
org.apache.webbeans.test.interceptors.factory.beans.UnproxyableClassProducer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class UnproxyableClassWithInterfaceFactoryTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testInterceptionOnUnproxyableClassWithInterface() throws
Exception
+ {
+ addInterceptor(TransactionalInterceptor.class);
+ startContainer(UnproxyableClassProducer.class);
+ UnproxyableClassInterface instance =
getInstance(UnproxyableClassInterface.class);
+ Assert.assertEquals("intercepted dummy", instance.getName());
+ shutDownContainer();
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterceptionFactoryBeansProducer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterceptionFactoryBeansProducer.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterceptionFactoryBeansProducer.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterceptionFactoryBeansProducer.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,78 @@
+/*
+ * 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.webbeans.test.interceptors.factory.beans;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InterceptionFactory;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Named;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure2;
+import
org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+public class InterceptionFactoryBeansProducer {
+
+ private static class Secure2Literal extends AnnotationLiteral<Secure2>
implements Secure2 {
+
+ @Override
+ public String[] rolesAllowed() {
+ return new String[0];
+ }
+ }
+
+ private final class UnproxyableClass implements
InterfaceWithoutInterceptors {
+
+ private final String name;
+
+ public UnproxyableClass(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+ }
+
+ @Produces
+ @Named("noInterceptorOnTheInterface")
+ public InterfaceWithoutInterceptors
noInterceptorOnTheInterface(InterceptionFactory<InterfaceWithoutInterceptors>
factory) {
+ return factory.createInterceptedInstance(new
UnproxyableClass("dummy"));
+ }
+
+ @Produces
+ @Named("interceptorsOnTheInterface")
+ public InterfaceWithInterceptors
interceptorsOnTheInterface(InterceptionFactory<InterfaceWithInterceptors>
factory) {
+ return factory.createInterceptedInstance(() -> "dummy");
+ }
+
+ @Produces
+ @Named("noInterceptorOnTheInterfacePlusProgrammaticallyAddedBindings")
+ public InterfaceWithoutInterceptors
noInterceptorOnTheInterfacePlusProgrammaticallyAddedBindings(InterceptionFactory<InterfaceWithoutInterceptors>
factory) {
+ factory.configure().add(new AnnotationLiteral<Transactional>()
{});
+ return factory.createInterceptedInstance(new
UnproxyableClass("dummy"));
+ }
+
+ @Produces
+ @Named("interceptorsOnTheInterfacePlusProgrammaticallyAddedBindings")
+ public InterfaceWithInterceptors
interceptorsOnTheInterfacePlusProgrammaticallyAddedBindings(InterceptionFactory<InterfaceWithInterceptors>
factory) {
+ factory.configure().add(new Secure2Literal());
+ return factory.createInterceptedInstance(() -> "dummy");
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithInterceptors.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithInterceptors.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithInterceptors.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithInterceptors.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,32 @@
+/*
+ * 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.webbeans.test.interceptors.factory.beans;
+
+import
org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+public interface InterfaceWithInterceptors {
+
+ @Transactional
+ String getName();
+
+ @Transactional
+ default String getDefaultName() {
+ return "John Doe";
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithoutInterceptors.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithoutInterceptors.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithoutInterceptors.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/InterfaceWithoutInterceptors.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.test.interceptors.factory.beans;
+
+public interface InterfaceWithoutInterceptors {
+
+ String getName();
+
+ default String getDefaultName() {
+ return "John Doe";
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/Secure2Interceptor.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/Secure2Interceptor.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/Secure2Interceptor.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/Secure2Interceptor.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.interceptors.factory.beans;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure2;
+
+@Interceptor
+@Secure2
+public class Secure2Interceptor implements Serializable
+{
+
+ @AroundInvoke
+ public Object caller(InvocationContext context) throws Exception
+ {
+ Object result = context.proceed();
+ if (result instanceof String) {
+ result = result + " secured";
+ }
+ return result;
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/TransactionalInterceptor.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/TransactionalInterceptor.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/TransactionalInterceptor.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/TransactionalInterceptor.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,43 @@
+/*
+ * 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.webbeans.test.interceptors.factory.beans;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+import
org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+@Interceptor
+@Transactional
+public class TransactionalInterceptor implements Serializable
+{
+
+ @AroundInvoke
+ public Object caller(InvocationContext context) throws Exception
+ {
+ Object result = context.proceed();
+ if (result instanceof String) {
+ result = "intercepted " + result;
+ }
+ return result;
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClass.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClass.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClass.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClass.java
Tue Mar 12 13:27:19 2019
@@ -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.webbeans.test.interceptors.factory.beans;
+
+public final class UnproxyableClass implements UnproxyableClassInterface {
+
+ private final String name;
+
+ public UnproxyableClass(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassInterface.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassInterface.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassInterface.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassInterface.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,24 @@
+/*
+ * 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.webbeans.test.interceptors.factory.beans;
+
+public interface UnproxyableClassInterface {
+
+ String getName();
+}
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassProducer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassProducer.java?rev=1855319&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassProducer.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/factory/beans/UnproxyableClassProducer.java
Tue Mar 12 13:27:19 2019
@@ -0,0 +1,34 @@
+/*
+ * 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.webbeans.test.interceptors.factory.beans;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InterceptionFactory;
+import javax.enterprise.util.AnnotationLiteral;
+
+import
org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
+
+public class UnproxyableClassProducer {
+
+ @Produces
+ public UnproxyableClassInterface
unproxyableClass(InterceptionFactory<UnproxyableClassInterface> factory) {
+ factory.configure().add(new AnnotationLiteral<Transactional>()
{});
+ return factory.createInterceptedInstance(new
UnproxyableClass("dummy"));
+ }
+}