Repository: tomee Updated Branches: refs/heads/fb_tomee8 3c2703a8e -> 32c0c60d5
validating EJB producers/disposes in case of remote declaration Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/32c0c60d Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/32c0c60d Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/32c0c60d Branch: refs/heads/fb_tomee8 Commit: 32c0c60d55a9b765c4eb9265169ecc76fb436ddc Parents: 3c2703a Author: Romain Manni-Bucau <rmannibu...@gmail.com> Authored: Thu Feb 1 14:43:01 2018 +0100 Committer: Romain Manni-Bucau <rmannibu...@gmail.com> Committed: Thu Feb 1 14:43:01 2018 +0100 ---------------------------------------------------------------------- .../src/main/java/org/apache/openejb/cdi/CdiPlugin.java | 11 +++++++---- tck/cdi-embedded/src/test/resources/failing.xml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/32c0c60d/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java index 5a2042c..af39cd6 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java @@ -501,8 +501,9 @@ public class CdiPlugin extends AbstractOwbPlugin implements OpenWebBeansJavaEEPl for (final ProducerMethodBean<?> m : methods) { final Method method = m.getCreatorMethod(); - if (doResolveViewMethod(bean, method) == null) { - throw new WebBeansConfigurationException("@Produces " + method + " not in the ejb view of ejb " + beanContext.getEjbName()); + final Method viewMethod = doResolveViewMethod(bean, method); + if (viewMethod == null || beanContext.getBusinessRemoteInterfaces().contains(viewMethod.getDeclaringClass())) { + throw new WebBeansConfigurationException("@Produces " + method + " not in a local ejb view of ejb " + beanContext.getEjbName()); } } } @@ -529,8 +530,10 @@ public class CdiPlugin extends AbstractOwbPlugin implements OpenWebBeansJavaEEPl if (m.getParameterTypes().length > 0) { for (final Annotation[] a : m.getParameterAnnotations()) { for (final Annotation ann : a) { - if (ann.annotationType().equals(Disposes.class) && doResolveViewMethod(bean, m) == null) { - throw new WebBeansConfigurationException("@Disposes is forbidden on non business EJB methods"); + final Method method = doResolveViewMethod(bean, m); + if (ann.annotationType().equals(Disposes.class) && + (method == null || bean.getBeanContext().getBusinessRemoteInterfaces().contains(method.getDeclaringClass()))) { + throw new WebBeansConfigurationException("@Disposes is forbidden on non business or remote EJB methods"); } } } http://git-wip-us.apache.org/repos/asf/tomee/blob/32c0c60d/tck/cdi-embedded/src/test/resources/failing.xml ---------------------------------------------------------------------- diff --git a/tck/cdi-embedded/src/test/resources/failing.xml b/tck/cdi-embedded/src/test/resources/failing.xml index 15aa7cc..814e116 100644 --- a/tck/cdi-embedded/src/test/resources/failing.xml +++ b/tck/cdi-embedded/src/test/resources/failing.xml @@ -39,7 +39,7 @@ TODO these are tests we finally need to pass! --> <classes> - <class name="org.jboss.cdi.tck.tests.event.observer.context.async.enterprise.EnterpriseSecurityContextPropagationInAsyncObserverTest" /> + <class name="org.jboss.cdi.tck.tests.implementation.producer.method.broken.enterprise.remoteMethod.RemoteBusinessProducerMethodTest" /> </classes> </test> </suite>