Skip to content

Commit 07326ac

Browse files
authored
Merge pull request #276 from aidentZhang/transactions-tck-runner-squashed
Transactions-tck runner for wildfly
2 parents 5688f8d + 22cc38a commit 07326ac

18 files changed

Lines changed: 1658 additions & 0 deletions

File tree

jakarta-ee-tck-runners/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
<version.jakarta.ejb.short>4.0</version.jakarta.ejb.short>
103103
<version.jakarta.ejb.api>${version.jakarta.ejb.short}.0</version.jakarta.ejb.api>
104104

105+
105106
<version.jakarta.json.short>2.1</version.jakarta.json.short>
106107
<version.jakarta.json.tck>${version.jakarta.json.short}.1</version.jakarta.json.tck>
107108

@@ -114,6 +115,9 @@
114115
<version.jakarta.servlet.short>6.1</version.jakarta.servlet.short>
115116
<version.jakarta.servlet.api>${version.jakarta.servlet.short}.0</version.jakarta.servlet.api>
116117

118+
<version.jakarta.transaction.short>2.0.1</version.jakarta.transaction.short>
119+
<version.jakarta.transaction.api>${version.jakarta.transaction.short}</version.jakarta.transaction.api>
120+
117121
<version.jakarta.ws.rs.short>4.0</version.jakarta.ws.rs.short>
118122

119123
<!-- Specification implementation versions, please keep these in alphabetical order -->
@@ -469,6 +473,7 @@
469473
<module>jsonb-tck</module>
470474
<module>jsonp-tck</module>
471475
<module>rest-tck</module>
476+
<!-- <module>transactions-tck</module> -->
472477
</modules>
473478
</profile>
474479

Lines changed: 301 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,301 @@
1+
<!--
2+
~ Copyright The WildFly Authors
3+
~ SPDX-License-Identifier: Apache-2.0
4+
-->
5+
6+
# Jakarta Transactions TCK Runner for WildFly
7+
8+
This module provides a comprehensive test runner for the Jakarta Transactions TCK (Technology Compatibility Kit) on WildFly application server.
9+
10+
## Overview
11+
12+
The Jakarta Transactions TCK Runner validates WildFly's implementation of the Jakarta Transactions specification by executing the official TCK test suite. This runner includes custom Arquillian extensions, database setup utilities, and configuration files necessary to run the complete test suite.
13+
14+
## Test Coverage
15+
16+
The Transactions TCK includes **195 tests** across two deployment modes:
17+
18+
- **166 Web-based tests**: Tests deployed as web applications (WAR files) using Servlet and JSP containers
19+
- **29 AppClient tests**: Tests deployed as application client containers (EJB tests)
20+
21+
### Test Categories
22+
23+
- **Transactional CDI Tests**: Tests for `@Transactional` annotation support in CDI beans
24+
- **Transaction Propagation Tests**: Tests for transaction context propagation across components
25+
- **UserTransaction Tests**: Tests for programmatic transaction management via `UserTransaction` API
26+
- **XA Transaction Tests**: Tests for distributed transaction coordination
27+
28+
29+
```
30+
31+
## Prerequisites
32+
33+
- **Java**: JDK 11 or later
34+
- **Maven**: 3.6.0 or later
35+
- **WildFly**: Latest version (configured via parent POM)
36+
- **Derby Database**: 10.16.1.1 (automatically managed)
37+
38+
## Building and Running
39+
40+
### Default Build (Web Tests Only)
41+
42+
Run the web-based tests (166 tests):
43+
44+
```bash
45+
mvn clean install
46+
```
47+
48+
### With AppClient Tests
49+
50+
Run all tests including AppClient tests (195 tests):
51+
52+
```bash
53+
mvn clean install -Pappclient
54+
```
55+
56+
### Skip TCK Download
57+
58+
If you already have the TCK artifacts in your local Maven repository:
59+
60+
```bash
61+
mvn clean install -Pappclient -P!download-tck
62+
```
63+
64+
### Custom WildFly Installation
65+
66+
Specify a custom WildFly installation:
67+
68+
```bash
69+
mvn clean install -Djboss.home=/path/to/wildfly
70+
```
71+
72+
## Configuration
73+
74+
### ts.jte - JavaTest Environment
75+
76+
The `jakartaeetck/bin/ts.jte` file contains TCK test configuration properties including:
77+
78+
- Test environment settings
79+
- Server connection parameters
80+
- Database configuration
81+
- Deployment settings
82+
- Test execution parameters
83+
84+
This file is automatically copied to `target/ts.jte` during the build process.
85+
86+
### Arquillian Configuration
87+
88+
Two Arquillian configuration files are provided:
89+
90+
#### arquillian.xml (Web Tests)
91+
92+
- **Container**: `tck-javatest` (default)
93+
- **Protocol**: JavaTest protocol for web-based tests
94+
- **Configuration**: Managed WildFly container with standard settings
95+
96+
#### appclient-arquillian.xml (AppClient Tests)
97+
98+
- **Container**: `tck-appclient`
99+
- **Protocol**: AppClient protocol for EJB tests
100+
- **Configuration**: Standalone container instance for AppClient tests
101+
102+
### Database Configuration
103+
104+
The TCK requires a Derby database with the CTS1 schema. Database setup is automated during the build process.
105+
106+
#### Datasources
107+
108+
Two datasources are configured via `setup-database.cli`:
109+
110+
- **ExampleDS**: `java:jboss/datasources/ExampleDS`
111+
- **DB1**: `java:jboss/datasources/DB1`
112+
113+
Both datasources point to the same Derby database at `${jboss.home}/standalone/data/derbyDB`.
114+
115+
#### Database Credentials
116+
117+
- **Username**: `cts1`
118+
- **Password**: `cts1`
119+
- **Schema**: `CTS1`
120+
121+
### Certificate Management
122+
123+
SSL certificates for AppClient tests are automatically extracted from the TCK artifact to `jakartaeetck/bin/certificates/`:
124+
125+
- `clientcert.jks` - Java KeyStore containing client certificates
126+
- `clientcert.p12` - PKCS12 format client certificate
127+
- `cts_cert` - Certificate file for TCK test suite
128+
129+
## Key Components
130+
131+
### WildFlyExtension
132+
133+
Arquillian LoadableExtension that registers custom components:
134+
135+
- **WildFlyTestArchiveProcessor**: Modifies test archives before deployment
136+
- **WildFlyExceptionTransformer**: Transforms deployment exceptions for better error reporting
137+
138+
### WildFlyTestArchiveProcessor
139+
140+
Processes test archives to:
141+
142+
- Add required dependencies
143+
- Modify deployment descriptors
144+
- Configure test-specific settings
145+
146+
### AppClientInitialContextFactory
147+
148+
Custom InitialContextFactory for AppClient tests that provides proper JNDI context initialization for the WildFly environment.
149+
150+
### DbSetup
151+
152+
Database initialization utility that:
153+
154+
1. Creates the Derby database (if it doesn't exist)
155+
2. Creates the CTS1 schema
156+
3. Executes DDL statements from `derby.ddl.sql`
157+
4. Properly shuts down the Derby database
158+
159+
Executed automatically during the `process-test-classes` phase.
160+
161+
## Database Setup
162+
163+
### Automated Setup
164+
165+
The database is automatically initialized during the Maven build:
166+
167+
1. **DbSetup Execution** (`process-test-classes` phase):
168+
- Creates Derby database at `${jboss.home}/standalone/data/derbyDB`
169+
- Creates CTS1 schema
170+
- Executes DDL from `sql/derby/derby.ddl.sql`
171+
172+
2. **WildFly Configuration** (`process-test-classes` phase):
173+
- Executes `setup-database.cli` script
174+
- Configures Derby JDBC driver
175+
- Creates ExampleDS and DB1 datasources
176+
177+
### Manual Database Setup
178+
179+
If needed, you can manually set up the database:
180+
181+
```bash
182+
# Run DbSetup utility
183+
java -cp target/test-classes:derby.jar \
184+
org.jboss.wildfly.tck.transactions.DbSetup \
185+
jdbc:derby:/path/to/derbyDB \
186+
sql/derby/derby.ddl.sql
187+
188+
# Configure WildFly
189+
${JBOSS_HOME}/bin/jboss-cli.sh --file=src/test/resources/setup-database.cli
190+
```
191+
192+
### Database Schema
193+
194+
The CTS1 schema includes 4 tables:
195+
196+
- **JTA_Tab1**: Transaction propagation test table (KEY_ID, COF_NAME, PRICE)
197+
- **JTA_Tab2**: Transaction propagation test table (KEY_ID, CHOC_NAME, PRICE)
198+
- **caller**: Security/authentication table (name, password)
199+
- **caller_groups**: Security/authentication groups table (caller_name, group_name)
200+
201+
## Project Structure
202+
203+
### transactions-tck-setup
204+
205+
Downloads and unpacks the Jakarta Transactions TCK artifact. This module:
206+
207+
- Declares dependency on `jakarta.tck:transactions-tck`
208+
- Unpacks TCK JAR to `target/tck` directory
209+
- Provides TCK artifacts to the runner module
210+
211+
### transactions-tck-runner
212+
213+
Main test execution module that:
214+
215+
- Configures WildFly server
216+
- Sets up Derby database
217+
- Executes TCK tests via Maven Failsafe plugin
218+
- Generates test reports
219+
220+
## Test Execution Flow
221+
222+
1. **Setup Phase** (`generate-test-resources`):
223+
- Copy SQL files to `target/test-classes/sql/derby/`
224+
- Copy ts.jte to `target/test-classes/jakartaeetck/bin/`
225+
- Unpack certificates from TCK artifact
226+
227+
2. **Database Initialization** (`process-test-classes`):
228+
- Execute DbSetup to create Derby database and schema
229+
- Execute setup-database.cli to configure WildFly datasources
230+
231+
3. **Test Execution** (`integration-test`):
232+
- Start WildFly managed container
233+
- Deploy test archives via Arquillian
234+
- Execute TCK tests
235+
- Collect results
236+
237+
4. **Verification** (`verify`):
238+
- Verify test results
239+
- Generate reports
240+
- Fail build if tests fail
241+
242+
## Troubleshooting
243+
244+
### Database Connection Issues
245+
246+
If you encounter database connection errors:
247+
248+
1. Verify Derby database exists: `${jboss.home}/standalone/data/derbyDB`
249+
2. Check database credentials in `setup-database.cli`
250+
3. Ensure CTS1 schema was created successfully
251+
4. Review DbSetup output in build logs
252+
253+
### AppClient Test Failures
254+
255+
If AppClient tests fail:
256+
257+
1. Verify certificates are extracted: `jakartaeetck/bin/certificates/`
258+
2. Check `appclient-arquillian.xml` configuration
259+
3. Ensure `ts.home`, `project.basedir`, and `jboss.home` system properties are set
260+
4. Review AppClient container logs
261+
262+
### Test Discovery Issues
263+
264+
If tests are not discovered:
265+
266+
1. Verify TCK artifact is downloaded: `target/dependency/lib/transactions-tck.jar`
267+
2. Check `dependenciesToScan` configuration in POM
268+
3. Ensure test includes patterns match TCK test classes
269+
4. Review Maven Failsafe plugin output
270+
271+
### WildFly Configuration Issues
272+
273+
If WildFly fails to start or configure:
274+
275+
1. Verify `jboss.home` property points to valid WildFly installation
276+
2. Check `setup-database.cli` script execution output
277+
3. Ensure Derby JDBC driver module is available
278+
4. Review WildFly server logs: `${jboss.home}/standalone/log/server.log`
279+
280+
### Build Performance
281+
282+
To speed up builds:
283+
284+
- Use `-P!download-tck` to skip TCK download if already cached
285+
- Use `-DskipTests` to skip test execution (build only)
286+
- Use `-Dmaven.test.failure.ignore=true` to continue on test failures
287+
288+
## Additional Resources
289+
290+
- [Jakarta Transactions Specification](https://jakarta.ee/specifications/transactions/)
291+
- [Jakarta Transactions TCK](https://github.com/jakartaee/transactions)
292+
- [WildFly Documentation](https://docs.wildfly.org/)
293+
- [Arquillian Documentation](http://arquillian.org/guides/)
294+
295+
## License
296+
297+
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
298+
299+
---
300+
301+
<!-- Made with Bob -->
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.wildfly.tck</groupId>
9+
<artifactId>wildfly-jakarta-ee-tck-runners-parent</artifactId>
10+
<version>1.0.0-SNAPSHOT</version>
11+
<relativePath>../pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>transactions-tck</artifactId>
15+
<name>WildFly Jakarta Transactions TCK Runner</name>
16+
<description>Runs the Jakarta Transactions TCK</description>
17+
<packaging>pom</packaging>
18+
19+
<modules>
20+
<module>transactions-tck-setup</module>
21+
<module>transactions-tck-runner</module>
22+
</modules>
23+
24+
</project>
25+
26+
<!-- Made with Bob -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<application-client version="10" xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/application-client_10.xsd">
6+
<description>TS ejbvehicle client</description>
7+
<display-name>begin_ejb_vehicle_client</display-name>
8+
<ejb-ref>
9+
<ejb-ref-name>ejb/EJBVehicle</ejb-ref-name>
10+
<ejb-ref-type>Session</ejb-ref-type>
11+
<remote>com.sun.ts.tests.common.vehicle.ejb.EJBVehicleRemote</remote>
12+
</ejb-ref>
13+
</application-client>
14+
15+
<!-- Made with Bob -->

0 commit comments

Comments
 (0)