apupier opened a new pull request, #29515: URL: https://github.com/apache/camel/pull/29515
# Description Part of [CAMEL-25891](https://issues.apache.org/jira/browse/CAMEL-25891), split out of the discussion in #28303. The tests of `camel-spring-xml` implicitly rely on being run in isolated forks: they share state at JVM level, so running test classes concurrently (`-Dcamel.surefire.parallel=true`) made about 115 of them fail. This PR removes those hidden dependencies. It is a robustness improvement of the tests only. **The default build is unchanged** (the module still runs with `camel.surefire.parallel=false`, no pom change). What is changed: - **H2**: all 7 `<jdbc:embedded-database>` used Spring's default name (`testdb`), so concurrent contexts created the `books` table in the same database. They now use `generate-name="true"`. - **`testDirectory`**: `SpringTestHelper` stored the per-test temp directory in the JVM-wide system properties, so concurrent tests overwrote each other. It is now a `MapPropertySource` of the application context, read from the Spring environment in the two file based idempotent repository XMLs. The two tests using an `ApplicationContextInitializer` use a test-specific property name. - **`SpringPropertyPlaceholderIssueTest`** only passed if another test of the same JVM had leaked the `testDirectory` system property (it fails when run alone on `main`). The placeholder now has a default value. - **JMX**: 36 test classes querying/counting MBeans in the platform MBeanServer are marked `@Isolated` (they run alone; all other classes can still run concurrently). - **`camel-core` `TestSupportJmxCleanup`**: ignore `InstanceNotFoundException` when removing the domain's MBeans, as a concurrent test may already have unregistered them (small test-code change in a shared module, worth a look). # Verification `camel-spring-xml`, 1186 tests, `mvn surefire:test -Dcamel.surefire.forkCount=1 -Dcamel.surefire.parallel=true -Dcamel.surefire.parallel.factor=1`: - before: 116 failures/errors (27 when pinned to 4 cores) - after: 0 failures, 6 runs (one run had a single flake in `Camel14624Test` tearDown, the rerun passed) - default configuration (4 sequential forks) still green # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (formatter/impsort run on the module; no generated files are affected, test code only) # AI-assisted contributions - [x] This PR was prepared with IBM Bob 2.2.1 (AI agent); the commit has the `Co-authored-by` trailer. _IBM Bob 2.2.1 on behalf of @apupier. This description was AI-generated; please verify._ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
