From 5d51ff854aae8dacd3713c5626669e0402aa9860 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Sat, 25 Jul 2026 17:56:39 +0200 Subject: [PATCH] [OWB-1470] Setup CDI SE TCK --- pom.xml | 3 + webbeans-tck-se/README.md | 70 ++++++ webbeans-tck-se/pom.xml | 219 ++++++++++++++++++ webbeans-tck-se/se-suite.xml | 171 ++++++++++++++ .../openwebbeans/openwebbeans.properties | 40 ++++ .../resources/META-INF/cdi-tck.properties | 23 ++ .../src/test/resources/arquillian.xml | 38 +++ webbeans-tck/pom.xml | 2 +- webbeans-tck/standalone-suite.xml | 8 +- webbeans-tck/testng-dev.xml | 4 +- 10 files changed, 572 insertions(+), 6 deletions(-) create mode 100644 webbeans-tck-se/README.md create mode 100644 webbeans-tck-se/pom.xml create mode 100644 webbeans-tck-se/se-suite.xml create mode 100644 webbeans-tck-se/src/main/resources/META-INF/openwebbeans/openwebbeans.properties create mode 100644 webbeans-tck-se/src/test/resources/META-INF/cdi-tck.properties create mode 100644 webbeans-tck-se/src/test/resources/arquillian.xml diff --git a/pom.xml b/pom.xml index 23a441ec0..cd38d7d74 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,8 @@ 4.5.14 4.31 1.8.1.Final + + 1.0.2.Final 4.1.0 4.0 @@ -734,6 +736,7 @@ webbeans-ee webbeans-jms webbeans-tck + webbeans-tck-se webbeans-jsf webbeans-osgi distribution diff --git a/webbeans-tck-se/README.md b/webbeans-tck-se/README.md new file mode 100644 index 000000000..00d39535f --- /dev/null +++ b/webbeans-tck-se/README.md @@ -0,0 +1,70 @@ + +# Jakarta CDI SE TCK runner + +Runs the SE part of the Jakarta Contexts and Dependency Injection TCK +(`org.jboss.cdi.tck.tests.se.*`) against OpenWebBeans. + + mvn test -pl webbeans-tck-se + +The specification this is checked against is +[Jakarta Contexts and Dependency Injection 4.1](https://jakarta.ee/specifications/cdi/4.1/) +(part of Jakarta EE 11); section numbers below refer to the +[4.1 specification document](https://jakarta.ee/specifications/cdi/4.1/jakarta-cdi-spec-4.1.html). + +## Why this is a separate module + +The other TCK suites live in `webbeans-tck` and run in the in-VM +`owb-arquillian-standalone` container. The SE tests cannot: they bootstrap +`SeContainerInitializer` themselves and build their deployment with +`org.jboss.arquillian.container.se.api.ClassPath`, which only the Arquillian +*SE managed* container understands. That container forks a fresh JVM per +deployment and talks to it over JMX. + +Arquillian discovers `DeployableContainer` implementations through the +`ServiceLoader` and aborts with + + Multiple service implementations found for interface ...DeployableContainer + +as soon as two of them are on one classpath. That happens during bootstrap, +before `arquillian.launch` or the `arquillian.xml` container qualifier are +consulted, so the two containers cannot be separated by configuration - they +need separate classpaths, i.e. separate modules. + +## How the forked JVM is set up + +* `maven-dependency-plugin` copies all dependencies into the staging directory + (`target/se-libs`). `ManagedSEDeployableContainer` puts every `*.jar` in that + directory on the classpath of the JVM it forks. +* That directory is defined once, by the `owb.se.tck.librariesPath` property in + `pom.xml`. The two files that also have to name it - + `arquillian.xml` (`librariesPath`) and `META-INF/cdi-tck.properties` + (`org.jboss.cdi.tck.libraryDirectory`) - get it via test resource filtering, + so the path is not repeated as a literal anywhere. Filtering expands it to an + absolute path, which the SE container handles fine (it does + `new File(librariesPath)`). +* `maven-antrun-plugin` additionally zips this module's own compiled + `src/main/resources` into `target/se-libs/openwebbeans-tck-se-config.jar`. + That is the only way to get + `META-INF/openwebbeans/openwebbeans.properties` in front of OWB inside the + forked JVM - `src/test/resources` is never on that JVM's classpath, and a + `-D` system property does not work either because + `OpenWebBeansConfiguration.overrideWithGlobalSettings()` only consults + `System.getProperties()` for keys that already exist in a configuration file. +* `container-se-managed` is old (1.0.2.Final, 2017) and still depends on + Arquillian 1.1.15.Final. Those transitive artifacts are excluded in `pom.xml` + and re-declared at `${arquillian.version}`, otherwise the run fails with + `NoClassDefFoundError` on SPI types that only exist in current Arquillian. diff --git a/webbeans-tck-se/pom.xml b/webbeans-tck-se/pom.xml new file mode 100644 index 000000000..1626218bf --- /dev/null +++ b/webbeans-tck-se/pom.xml @@ -0,0 +1,219 @@ + + + + 4.0.0 + + org.apache.openwebbeans + openwebbeans + 4.1.1-SNAPSHOT + ../pom.xml + + + openwebbeans-tck-se + Jakarta CDI SE TCK runner + jar + The Jakarta Contexts and Dependency Injection SE TCK (org.jboss.cdi.tck.tests.se.*) for the Apache OpenWebBeans Implementation + + + + ${project.build.directory}/se-libs + + + + + + org.testng + testng + 7.10.2 + + + + + org.apache.openwebbeans + openwebbeans-se + ${project.version} + + + + org.apache.openwebbeans + openwebbeans-porting + + + + + org.jboss.arquillian.container + container-se-managed + ${arquillian.se.container.version} + + + + org.jboss.arquillian.container + arquillian-container-test-spi + + + org.jboss.arquillian.protocol + arquillian-protocol-jmx + + + + + + org.jboss.arquillian.container + arquillian-container-test-spi + ${arquillian.version} + + + org.jboss.arquillian.protocol + arquillian-protocol-jmx + ${arquillian.version} + + + + org.jboss.arquillian.container + arquillian-container-test-impl-base + ${arquillian.version} + + + org.jboss.arquillian.testng + arquillian-testng-container + ${arquillian.version} + + + + jakarta.enterprise + cdi-tck-core-impl + ${cdi.tck.version} + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.servlet + jakarta.servlet-api + + + jakarta.servlet.jsp + jakarta.servlet.jsp-api + + + jakarta.interceptor + jakarta.interceptor-api + + + jakarta.annotation + jakarta.annotation-api + + + jakarta.el + jakarta.el-api + + + jakarta.inject + jakarta.inject-api + + + jakarta.ejb + jakarta.ejb-api + + + + + + + + + src/test/resources + true + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-se-tck-libraries + process-test-resources + + copy-dependencies + + + ${owb.se.tck.librariesPath} + test + false + true + true + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + owb-config-jar-for-forked-jvm + process-test-resources + + run + + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + se-suite.xml + + + + + + + diff --git a/webbeans-tck-se/se-suite.xml b/webbeans-tck-se/se-suite.xml new file mode 100644 index 000000000..68054a478 --- /dev/null +++ b/webbeans-tck-se/se-suite.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webbeans-tck-se/src/main/resources/META-INF/openwebbeans/openwebbeans.properties b/webbeans-tck-se/src/main/resources/META-INF/openwebbeans/openwebbeans.properties new file mode 100644 index 000000000..74128f1d2 --- /dev/null +++ b/webbeans-tck-se/src/main/resources/META-INF/openwebbeans/openwebbeans.properties @@ -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. +#--------------------------------------------------------------- +# OpenWebBeans configuration for the CDI SE TCK. +# +# This file has to live in src/main/resources: the JVM that the Arquillian SE container forks per +# deployment builds its classpath from target/se-libs plus the deployment archive, so OWB only ever +# sees this configuration because the module jar itself is staged into target/se-libs (see pom.xml). +# A copy in src/test/resources would never be read by the child JVM. +# +# Note this cannot be expressed as a -D system property either: OWB's +# OpenWebBeansConfiguration.overrideWithGlobalSettings() only consults System.getProperties() for +# keys that are already present in a configuration file, and scanBeansXmlOnly is not part of OWB's +# shipped defaults. +#--------------------------------------------------------------- + +# this is the tck configuration, thus it has a very high ordinal of 150 +configuration.ordinal=150 + +# target/se-libs contains cdi-tck-core-impl, which has no root META-INF/beans.xml. With OWB's +# default bean-discovery-mode of ALL that jar gets scanned anyway, and the TCK's deliberately +# invalid "broken" fixtures (e.g. tests/definition/stereotype/broken/multiplePriorities/SomeBean, +# which carries two @Priority stereotypes) then abort the boot of every single SE test with a +# definition error. Restricting discovery to archives that actually carry a beans.xml keeps the +# scan to the archive the test under test deployed, which is what the SE tests expect. +org.apache.webbeans.scanBeansXmlOnly=true diff --git a/webbeans-tck-se/src/test/resources/META-INF/cdi-tck.properties b/webbeans-tck-se/src/test/resources/META-INF/cdi-tck.properties new file mode 100644 index 000000000..b4eea60a3 --- /dev/null +++ b/webbeans-tck-se/src/test/resources/META-INF/cdi-tck.properties @@ -0,0 +1,23 @@ +# 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. +# filtered in from ${owb.se.tck.librariesPath}, see pom.xml +org.jboss.cdi.tck.libraryDirectory=${owb.se.tck.librariesPath} +org.jboss.cdi.tck.spi.Beans=org.apache.webbeans.test.tck.BeansImpl +org.jboss.cdi.tck.spi.Contexts=org.apache.webbeans.test.tck.ContextsImpl +org.jboss.cdi.tck.spi.Contextuals=org.apache.webbeans.test.tck.ContextualsImpl +org.jboss.cdi.tck.spi.CreationalContexts=org.apache.webbeans.test.tck.CreationalContextsImpl +org.jboss.cdi.tck.spi.EL=org.apache.webbeans.test.tck.ELImpl diff --git a/webbeans-tck-se/src/test/resources/arquillian.xml b/webbeans-tck-se/src/test/resources/arquillian.xml new file mode 100644 index 000000000..193742632 --- /dev/null +++ b/webbeans-tck-se/src/test/resources/arquillian.xml @@ -0,0 +1,38 @@ + + + + + + + + ${owb.se.tck.librariesPath} + + 60 + + + + diff --git a/webbeans-tck/pom.xml b/webbeans-tck/pom.xml index bf72f3f55..f26bd0f1a 100644 --- a/webbeans-tck/pom.xml +++ b/webbeans-tck/pom.xml @@ -27,7 +27,7 @@ openwebbeans-tck - JSR-365 TCK runner + Jakarta CDI TCK runner jar All TCK tests for the Apache OpenWebBeans Implementation diff --git a/webbeans-tck/standalone-suite.xml b/webbeans-tck/standalone-suite.xml index 12c89e8b9..09acc3f49 100644 --- a/webbeans-tck/standalone-suite.xml +++ b/webbeans-tck/standalone-suite.xml @@ -15,7 +15,7 @@ the specific language governing permissions and limitations under the License. --> - + @@ -33,7 +33,7 @@ --> - + @@ -45,7 +45,9 @@ - + diff --git a/webbeans-tck/testng-dev.xml b/webbeans-tck/testng-dev.xml index 654cf0992..897979a14 100644 --- a/webbeans-tck/testng-dev.xml +++ b/webbeans-tck/testng-dev.xml @@ -15,8 +15,8 @@ the specific language governing permissions and limitations under the License. --> - - + +