Details
-
Feature Request
-
Resolution: Unresolved
-
Optional
-
None
-
None
-
None
-
None
Description
Why would a test method need this?
- before: because it wants a clean database (or clean cache or clean cached history or clean session or clean ...)
- after: because it seriously disrupts the CDI container or enviroment. For example: it takes the configuration and changes it, it deletes some database files, ...
Note that the deployment should be CPU efficient:
If the container just deployed and this is the first test and before=true, then it shouldn't redeploy.
If it is the last test for a deployment and after=true, then it shouldn't redeploy.
Some hints from aslak on where to implement this:
create it as a extension
implement LoadableExtension
create some @Observer(precendece = -1) of EventContext<Before>
then @Inject Instance<Container> and @Inject Instance<Deployment>
read the before.getTestMethod().annotations..
if redeploy is .. container.get().getDeployableContainer().undeploy(deployment.getTestArchive())