Tests run: 1499, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ cdi-embedded --- [INFO] Building jar: /home/rmannibucau/dev/Apache/tomee-trunk/tck/cdi-embedded/target/cdi-embedded-2.0.0-SNAPSHOT.jar [INFO] [INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ cdi-embedded --- [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ cdi-embedded --- [INFO] Installing /home/rmannibucau/dev/Apache/tomee-trunk/tck/cdi-embedded/target/cdi-embedded-2.0.0-SNAPSHOT.jar to /home/rmannibucau/.m2/repository/org/apache/openejb/cdi-embedded/2.0.0-SNAPSHOT/cdi-embedded-2.0.0-SNAPSHOT.jar [INFO] Installing /home/rmannibucau/dev/Apache/tomee-trunk/tck/cdi-embedded/pom.xml to /home/rmannibucau/.m2/repository/org/apache/openejb/cdi-embedded/2.0.0-SNAPSHOT/cdi-embedded-2.0.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 05:31 min [INFO] Finished at: 2015-03-13T18:59:53+01:00 [INFO] Final Memory: 47M/615M [INFO] ------------------------------------------------------------------------
:) next step tomee but needs a bit of investment since setup is not done at all yet Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> ---------- Forwarded message ---------- From: <rmannibu...@apache.org> Date: 2015-03-13 19:00 GMT+01:00 Subject: tomee git commit: more validation for ejb specialization + remote interfaces are not part of the ejb api (for cdi) + better cdi tck state clean up using arquillian API To: comm...@tomee.apache.org Repository: tomee Updated Branches: refs/heads/master 5359f312b -> ba30d45dc more validation for ejb specialization + remote interfaces are not part of the ejb api (for cdi) + better cdi tck state clean up using arquillian API Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/ba30d45d Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/ba30d45d Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/ba30d45d Branch: refs/heads/master Commit: ba30d45dcca686ba2c3a28a8d9314ffacfb3300b Parents: 5359f31 Author: Romain Manni-Bucau <rmannibu...@apache.org> Authored: Fri Mar 13 18:59:58 2015 +0100 Committer: Romain Manni-Bucau <rmannibu...@apache.org> Committed: Fri Mar 13 18:59:58 2015 +0100 ---------------------------------------------------------------------- .../java/org/apache/openejb/cdi/CdiEjbBean.java | 3 +- .../java/org/apache/openejb/cdi/CdiPlugin.java | 15 +++++++-- tck/cdi-embedded/pom.xml | 1 - .../ArquillianTestCleanUpExtension.java | 35 ++++++++++++++++++++ .../tck/cdi/embedded/CleanUpAssembler.java | 34 ------------------- ....jboss.arquillian.core.spi.LoadableExtension | 1 + tck/cdi-embedded/src/test/resources/failing.xml | 2 +- 7 files changed, 52 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/ba30d45d/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java index b3a1702..0480090 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiEjbBean.java @@ -36,7 +36,6 @@ import org.apache.webbeans.intercept.InterceptorResolutionService; import org.apache.webbeans.portable.InjectionTargetImpl; import org.apache.webbeans.util.GenericsUtil; -import java.io.Serializable; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; @@ -363,12 +362,14 @@ public class CdiEjbBean<T> extends BaseEjbBean<T> implements InterceptedMarker, } } + /* not in EJB types - 3.2.2 of cdi 1.2 final List<Class> clRemote = beanContext.getBusinessRemoteInterfaces(); if (clRemote != null && !clRemote.isEmpty()) { for (final Class<?> c : clRemote) { ejbTypes.add(c); // parentInterfaces(c), but is it useful in practise? } } + */ ejbTypes.add(Object.class); } http://git-wip-us.apache.org/repos/asf/tomee/blob/ba30d45d/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 a06ea9b..8dab787 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 @@ -49,6 +49,7 @@ import org.apache.webbeans.spi.plugins.AbstractOwbPlugin; import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin; import org.apache.webbeans.spi.plugins.OpenWebBeansJavaEEPlugin; import org.apache.webbeans.spi.plugins.OpenWebBeansWebPlugin; +import org.apache.webbeans.util.GenericsUtil; import org.apache.webbeans.util.WebBeansUtil; import javax.enterprise.context.ApplicationScoped; @@ -300,8 +301,18 @@ public class CdiPlugin extends AbstractOwbPlugin implements OpenWebBeansJavaEEPl public <T> Bean<T> defineSessionBean(final Class<T> clazz, final BeanAttributes<T> attributes, final AnnotatedType<T> annotatedType) { final BeanContext bc = findBeanContext(webBeansContext, clazz); final Class<?> superClass = bc.getManagedClass().getSuperclass(); - if (superClass != Object.class && !isSessionBean(superClass) && annotatedType.isAnnotationPresent(Specializes.class)) { - throw new DefinitionException("You can only specialize another EJB: " + clazz); + if (annotatedType.isAnnotationPresent(Specializes.class)) { + if (superClass != Object.class && !isSessionBean(superClass)) { + throw new DefinitionException("You can only specialize another EJB: " + clazz); + } + final BeanContext parentBc = findBeanContext(webBeansContext, superClass); + final List<Class> businessLocalInterfaces = new ArrayList<>(parentBc.getBusinessLocalInterfaces()); + for (final Class<?> api : bc.getBusinessLocalInterfaces()) { + businessLocalInterfaces.removeAll(GenericsUtil.getTypeClosure(api)); + } + if (!businessLocalInterfaces.isEmpty()) { + throw new DefinitionException("You can only specialize another EJB with at least the same API: " + clazz); + } } final CdiEjbBean<T> bean = new OpenEJBBeanBuilder<T>(bc, webBeansContext, annotatedType, attributes).createBean(clazz, !annotatedType.isAnnotationPresent(Vetoed.class)); http://git-wip-us.apache.org/repos/asf/tomee/blob/ba30d45d/tck/cdi-embedded/pom.xml ---------------------------------------------------------------------- diff --git a/tck/cdi-embedded/pom.xml b/tck/cdi-embedded/pom.xml index 8ee76d9..e2c9e08 100644 --- a/tck/cdi-embedded/pom.xml +++ b/tck/cdi-embedded/pom.xml @@ -203,7 +203,6 @@ <openejb.cdi.producer.interception>false</openejb.cdi.producer.interception> <openejb.cdi.filter.classloader>false</openejb.cdi.filter.classloader> - <openejb.assembler>org.apache.openejb.tck.cdi.embedded.CleanUpAssembler</openejb.assembler> <openejb.jul.forceReload>true</openejb.jul.forceReload> <openejb.strict.interface.declaration>true</openejb.strict.interface.declaration> <openejb.http.mock-request>true</openejb.http.mock-request> http://git-wip-us.apache.org/repos/asf/tomee/blob/ba30d45d/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/ArquillianTestCleanUpExtension.java ---------------------------------------------------------------------- diff --git a/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/ArquillianTestCleanUpExtension.java b/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/ArquillianTestCleanUpExtension.java new file mode 100644 index 0000000..b0fda02 --- /dev/null +++ b/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/ArquillianTestCleanUpExtension.java @@ -0,0 +1,35 @@ +/* + * 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.openejb.tck.cdi.embedded; + +import org.jboss.arquillian.core.api.annotation.Observes; +import org.jboss.arquillian.core.spi.LoadableExtension; +import org.jboss.arquillian.test.spi.event.suite.AfterClass; +import org.jboss.cdi.tck.util.ActionSequence; + +public class ArquillianTestCleanUpExtension implements LoadableExtension { + @Override + public void register(final ExtensionBuilder extensionBuilder) { + extensionBuilder.observer(CleanUpObserver.class); + } + + public static class CleanUpObserver { + public void cleanup(@Observes final AfterClass ignored) { + ActionSequence.reset(); // avoids to leak between tests, works in war cause of classloading but not in embedded mode + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/ba30d45d/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/CleanUpAssembler.java ---------------------------------------------------------------------- diff --git a/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/CleanUpAssembler.java b/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/CleanUpAssembler.java deleted file mode 100644 index c31bd36..0000000 --- a/tck/cdi-embedded/src/test/java/org/apache/openejb/tck/cdi/embedded/CleanUpAssembler.java +++ /dev/null @@ -1,34 +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.openejb.tck.cdi.embedded; - -import org.apache.openejb.UndeployException; -import org.apache.openejb.assembler.classic.AppInfo; -import org.apache.openejb.assembler.classic.Assembler; -import org.apache.openejb.loader.SystemInstance; -import org.apache.openejb.spi.ContainerSystem; -import org.jboss.cdi.tck.util.ActionSequence; - -public class CleanUpAssembler extends Assembler { - @Override - public void destroyApplication(final AppInfo appInfo) throws UndeployException { - super.destroyApplication(appInfo); - if (SystemInstance.get().getComponent(ContainerSystem.class).getAppContexts().isEmpty()) { - ActionSequence.reset(); - } - } -} http://git-wip-us.apache.org/repos/asf/tomee/blob/ba30d45d/tck/cdi-embedded/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension ---------------------------------------------------------------------- diff --git a/tck/cdi-embedded/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/tck/cdi-embedded/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 0000000..e7e35c9 --- /dev/null +++ b/tck/cdi-embedded/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -0,0 +1 @@ +org.apache.openejb.tck.cdi.embedded.ArquillianTestCleanUpExtension http://git-wip-us.apache.org/repos/asf/tomee/blob/ba30d45d/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 b0a5663..9cad804 100644 --- a/tck/cdi-embedded/src/test/resources/failing.xml +++ b/tck/cdi-embedded/src/test/resources/failing.xml @@ -31,7 +31,7 @@ -Dopenejb.embedded.try-jsp=true --> <classes> - <class name="org.jboss.cdi.tck.tests.lookup.modules.SpecializedBeanInjectionNotAvailable02Test" /> + <class name="org.jboss.cdi.tck.tests.inheritance.specialization.enterprise.EnterpriseBeanSpecializationTest" /> </classes> </test> </suite>