"alesj" wrote : Yeah, something in this "delegate" direction.
|
| I would simply install a new temp bean,
| which gets BeanManager injected at a proper state.
|
I've had some success with this. The main stumbling block at the moment is that each
of my tests run in isolation is fine, but if I try to run them all I get an error on next
test setup:
| java.lang.IllegalStateException: Incompletely deployed:
|
| DEPLOYMENTS MISSING DEPENDENCIES:
| Deployment "vfs://top-level.ear/BootstrapBeanInstaller=SimpleBean" is
missing the following dependencies:
| Dependency "vfs://top-level.ear/_JBossDeployment" (should be in state
"Installed", but is actually not found)
| Dependency "vfs://top-level.ear/_WeldBootstrapBean" (should be in state
"Create", but is actually not found)
|
| at
org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
| at
org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
| at
org.jboss.test.kernel.junit.MicrocontainerTestDelegate.validate(MicrocontainerTestDelegate.java:262)
| at
org.jboss.test.kernel.junit.MicrocontainerTest.afterSetUp(MicrocontainerTest.java:117)
| at org.jboss.test.kernel.junit.MicrocontainerTest.setUp(MicrocontainerTest.java:91)
| at
org.jboss.test.deployers.BootstrapDeployersTest.setUp(BootstrapDeployersTest.java:350)
| at org.jboss.test.deployers.test.AbstractWeldTest.setUp(AbstractWeldTest.java:59)
|
'vfs://top-level.ear/BootstrapBeanInstaller=SimpleBean' is the
"intermediate" bean that installs SimpleBean once BootstrapBean is installed.
How to make sure it gets uninstalled along with the deployment? I tried adding it as an
attachment in the WeldKernelControllerContextCreator (used by BeanMetaDataDeployer) which
creates this bean but it is not uninstalled.
To summarize, I have a bean called SimpleBean. BMDDeployer +
WeldKernelControllerContextCreator install
'vfs://top-level.ear/BootstrapBeanInstaller=SimpleBean' instead, and this in turn
installs SimpleBean in its start() method. On uninstall BMDDeployer.undeploy() gets called
with SimpleBean, but not with
'vfs://top-level.ear/BootstrapBeanInstaller=SimpleBean'.
I will see if I can make 'vfs://top-level.ear/BootstrapBeanInstaller=SimpleBean'
uninstall itself, but it feels a bit strange to do that from its start() method.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263811#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...