rzo1 opened a new pull request, #2957: URL: https://github.com/apache/tomee/pull/2957
https://issues.apache.org/jira/browse/TOMEE-4714 ## Problem `@RunWithTomEEEmbedded` only works for the first container start of a JVM. The extension closes the container after each test (class), but `TomEEEmbeddedApplicationRunner#close()` never resets `started`, so the next `start(...)` returns early. No container is started and `@Application` / `@RandomPort` fields stay `null`. ## Change - `TomEEEmbeddedApplicationRunner#close()` resets `started`, so the runner can be started again. - `@RunWithTomEEEmbedded` gets a `mode` (`PER_JVM`, `PER_ALL`, `PER_EACH`, `AUTO`), like `@RunWithApplicationComposer`. `AUTO` is the default and keeps the current behaviour: it follows the lifecycle of the test instance. - `@RunWithTomEEEmbedded` is `@Inherited` now, like `@RunWithApplicationComposer`. - `TomEEEmbeddedBase` gets a `start(Class)` overload, as there is no test instance yet if the container is started for a test class. - `PER_JVM` can't be combined with the other modes in the same JVM, same restriction as for the ApplicationComposer. ## Tests Two new surefire executions in `tomee-embedded`, each running its test classes in one shared JVM: - `junit5-extension-modes`: `PER_EACH`, `PER_ALL` and `AUTO` (both test instance lifecycles). The container is started 8 times in that JVM. - `junit5-extension-mode-per-jvm`: two test classes sharing a single container. Not covered by a test: the guard rejecting a mix of `PER_JVM` and the other modes. -- 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]
