File tree Expand file tree Collapse file tree
container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 */
1818package org .jboss .arquillian .container .impl .client ;
1919
20+ import org .jboss .arquillian .container .spi .client .deployment .Deployment ;
2021import org .jboss .arquillian .container .spi .context .ContainerContext ;
2122import org .jboss .arquillian .container .spi .context .DeploymentContext ;
2223import org .jboss .arquillian .container .spi .event .ContainerControlEvent ;
2324import org .jboss .arquillian .container .spi .event .DeploymentEvent ;
25+ import org .jboss .arquillian .container .spi .event .UnDeployDeployment ;
2426import org .jboss .arquillian .core .api .Instance ;
2527import org .jboss .arquillian .core .api .annotation .Inject ;
2628import org .jboss .arquillian .core .api .annotation .Observes ;
@@ -72,4 +74,22 @@ public void createDeploymentContext(@Observes EventContext<DeploymentEvent> cont
7274 deploymentContext .deactivate ();
7375 }
7476 }
77+
78+ /**
79+ * Destroy the {@link DeploymentContext} after undeploy.
80+ *
81+ * @param context the events context
82+ */
83+ public void destroyDeploymentContext (@ Observes EventContext <UnDeployDeployment > context ) {
84+ final DeploymentContext deploymentContext = this .deploymentContext .get ();
85+ try {
86+ // Let undeploy happen first
87+ context .proceed ();
88+ } finally {
89+ // After undeploy completes, destroy the context
90+ final UnDeployDeployment event = context .getEvent ();
91+ final Deployment deployment = event .getDeployment ();
92+ deploymentContext .destroy (deployment );
93+ }
94+ }
7595}
You can’t perform that action at this time.
0 commit comments