Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
<httpclient.version>4.5.14</httpclient.version>
<xbean.version>4.31</xbean.version>
<arquillian.version>1.8.1.Final</arquillian.version>
<!-- the Arquillian "SE managed" container used by the CDI SE TCK; released separately from arquillian core -->
<arquillian.se.container.version>1.0.2.Final</arquillian.se.container.version>
<cdi.tck.version>4.1.0</cdi.tck.version>

<osgi.servlet.range>4.0</osgi.servlet.range>
Expand Down Expand Up @@ -734,6 +736,7 @@
<module>webbeans-ee</module>
<module>webbeans-jms</module>
<module>webbeans-tck</module>
<module>webbeans-tck-se</module>
<module>webbeans-jsf</module>
<module>webbeans-osgi</module>
<module>distribution</module>
Expand Down
70 changes: 70 additions & 0 deletions webbeans-tck-se/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--
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.
-->
# 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.
219 changes: 219 additions & 0 deletions webbeans-tck-se/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans</artifactId>
<version>4.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>openwebbeans-tck-se</artifactId>
<name>Jakarta CDI SE TCK runner</name>
<packaging>jar</packaging>
<description>The Jakarta Contexts and Dependency Injection SE TCK (org.jboss.cdi.tck.tests.se.*) for the Apache OpenWebBeans Implementation</description>

<properties>
<!--
The SE container forks a JVM per deployment; the jars for that JVM are staged here.
This is the single definition of that directory: it is filtered into arquillian.xml
(librariesPath) and META-INF/cdi-tck.properties (org.jboss.cdi.tck.libraryDirectory),
and used as the output directory of the two plugins that fill it.
-->
<owb.se.tck.librariesPath>${project.build.directory}/se-libs</owb.se.tck.librariesPath>
</properties>

<dependencies>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
</dependency>

<!-- the CDI implementation under test, including its SE bootstrap (SeContainerInitializer) -->
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-se</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-porting</artifactId>
</dependency>


<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>container-se-managed</artifactId>
<version>${arquillian.se.container.version}</version>

<exclusions>
<exclusion>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-jmx</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
<version>${arquillian.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-jmx</artifactId>
<version>${arquillian.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-impl-base</artifactId>
<version>${arquillian.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<version>${arquillian.version}</version>
</dependency>

<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-core-impl</artifactId>
<version>${cdi.tck.version}</version>
<exclusions>
<exclusion>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.interceptor</groupId>
<artifactId>jakarta.interceptor-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.ejb</groupId>
<artifactId>jakarta.ejb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>

<plugins>
<!--
The forked SE JVM has no maven and gets its classpath purely from the
librariesPath directory configured in arquillian.xml, so every jar it needs
(OWB, CDI API, the TCK, arquillian, testng, ...) has to be materialised here.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-se-tck-libraries</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${owb.se.tck.librariesPath}</outputDirectory>
<includeScope>test</includeScope>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>

<!--
src/main/resources/META-INF/openwebbeans/openwebbeans.properties configures OWB
inside the forked JVM. That JVM builds its classpath from the *.jar files in
${owb.se.tck.librariesPath} (ManagedSEDeployableContainer only accepts entries
ending in .jar), so this module's own resources have to be packaged as a jar there.
Bound to process-test-resources so it is in place before surefire runs.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>owb-config-jar-for-forked-jvm</id>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<zip destfile="${owb.se.tck.librariesPath}/openwebbeans-tck-se-config.jar"
basedir="${project.build.outputDirectory}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>se-suite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>

</project>
Loading
Loading