public Void call() throws Exception { for (Deployment d : suiteDeploymentScenario.deployments()) { deploymentEvent.fire(new UnDeployDeployment(findContainer(registry, event.getDeployableContainer()), d)); } return null; } });
@Override public Void call() throws Exception { DeployableContainer<?> deployableContainer = event.getDeployableContainer(); Deployment deployment = event.getDeployment(); DeploymentDescription description = deployment.getDescription(); deployEvent.fire(new BeforeUnDeploy(deployableContainer, description)); try { if (deployment.getDescription().isArchiveDeployment()) { try { deployableContainer.undeploy( description.getTestableArchive() != null ? description.getTestableArchive() : description.getArchive()); } catch (Exception e) { if (!deployment.hasDeploymentError()) { throw e; } } } else { deployableContainer.undeploy(description.getDescriptor()); } } finally { deployment.undeployed(); } deployEvent.fire(new AfterUnDeploy(deployableContainer, description)); return null; } });
@Override public Void call() throws Exception { DeployableContainer<?> deployableContainer = event.getDeployableContainer(); Deployment deployment = event.getDeployment(); DeploymentDescription description = deployment.getDescription(); deployEvent.fire(new BeforeUnDeploy(deployableContainer, description)); try { if (deployment.getDescription().isArchiveDeployment()) { try { deployableContainer.undeploy( description.getTestableArchive() != null ? description.getTestableArchive() : description.getArchive()); } catch (Exception e) { if (!deployment.hasDeploymentError()) { throw e; } } } else { deployableContainer.undeploy(description.getDescriptor()); } } finally { deployment.undeployed(); } deployEvent.fire(new AfterUnDeploy(deployableContainer, description)); return null; } });
public Void call() throws Exception { for (Deployment d : suiteDeploymentScenario.deployments()) { deploymentEvent.fire(new UnDeployDeployment(findContainer(registry, event.getDeployableContainer()), d)); } return null; } });
@Override public void perform(Container container, Deployment deployment) throws Exception { if (container.getState().equals(Container.State.STARTED) && deployment.isDeployed()) { event.fire(new UnDeployDeployment(container, deployment)); } } });
@Override public void perform(Container container, Deployment deployment) throws Exception { if (container.getState().equals(Container.State.STARTED) && deployment.isDeployed()) { event.fire(new UnDeployDeployment(container, deployment)); } } });
@Override public void undeploy(String name) { DeploymentScenario scenario = deploymentScenario.get(); if (scenario == null) { throw new IllegalArgumentException("No deployment scenario in context"); } ContainerRegistry registry = containerRegistry.get(); if (registry == null) { throw new IllegalArgumentException("No container registry in context"); } Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name)); if (deployment == null) { throw new IllegalArgumentException("No deployment in context found with name " + name); } if (deployment.getDescription().managed()) { throw new IllegalArgumentException( "Could not deploy " + name + " deployment. The deployment is controlled by Arquillian"); } Container container = registry.getContainer(deployment.getDescription().getTarget()); if (!container.getState().equals(State.STARTED)) { throw new IllegalArgumentException("Deployment with name " + name + " could not be undeployed. Container " + container.getName() + " must be still running."); } event.fire(new UnDeployDeployment(container, deployment)); }
@Override public void undeploy(String name) { DeploymentScenario scenario = deploymentScenario.get(); if (scenario == null) { throw new IllegalArgumentException("No deployment scenario in context"); } ContainerRegistry registry = containerRegistry.get(); if (registry == null) { throw new IllegalArgumentException("No container registry in context"); } Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name)); if (deployment == null) { throw new IllegalArgumentException("No deployment in context found with name " + name); } if (deployment.getDescription().managed()) { throw new IllegalArgumentException( "Could not deploy " + name + " deployment. The deployment is controlled by Arquillian"); } Container container = registry.getContainer(deployment.getDescription().getTarget()); if (!container.getState().equals(State.STARTED)) { throw new IllegalArgumentException("Deployment with name " + name + " could not be undeployed. Container " + container.getName() + " must be still running."); } event.fire(new UnDeployDeployment(container, deployment)); }
public Void call() throws Exception { for (Deployment d : suiteDeploymentScenario.deployments()) { deploymentEvent.fire(new UnDeployDeployment(findContainer(registry, event.getDeployableContainer()), d)); } return null; } });
@Override public void stop(String containerQualifier) { DeploymentScenario scenario = deploymentScenario.get(); if (scenario == null) { throw new IllegalArgumentException("No deployment scenario in context"); } ContainerRegistry registry = containerRegistry.get(); if (registry == null) { throw new IllegalArgumentException("No container registry in context"); } if (!containerExists(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("No container with the specified name exists"); } if (!isControllableContainer(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("Could not stop " + containerQualifier + " container. The container life cycle is controlled by Arquillian"); } Container container = registry.getContainer(new TargetDescription(containerQualifier)); List<Deployment> managedDeployments = scenario.startupDeploymentsFor(new TargetDescription(containerQualifier)); for (Deployment d : managedDeployments) { if (d.isDeployed()) { log.info("Automatic undeploying of the managed deployment with name " + d.getDescription().getName() + " from the container with name " + container.getName()); event.fire(new UnDeployDeployment(container, d)); } } log.info("Manual stopping of a server instance"); event.fire(new StopContainer(container)); }
@Override public void stop(String containerQualifier) { DeploymentScenario scenario = deploymentScenario.get(); if (scenario == null) { throw new IllegalArgumentException("No deployment scenario in context"); } ContainerRegistry registry = containerRegistry.get(); if (registry == null) { throw new IllegalArgumentException("No container registry in context"); } if (!containerExists(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("No container with the specified name exists"); } if (!isControllableContainer(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("Could not stop " + containerQualifier + " container. The container life cycle is controlled by Arquillian"); } Container container = registry.getContainer(new TargetDescription(containerQualifier)); List<Deployment> managedDeployments = scenario.startupDeploymentsFor(new TargetDescription(containerQualifier)); for (Deployment d : managedDeployments) { if (d.isDeployed()) { log.info("Automatic undeploying of the managed deployment with name " + d.getDescription().getName() + " from the container with name " + container.getName()); event.fire(new UnDeployDeployment(container, d)); } } log.info("Manual stopping of a server instance"); event.fire(new StopContainer(container)); }
log.info("Automatic undeploying of the managed deployment with name " + d.getDescription().getName() + " from the container with name " + container.getName()); getContainerControllerEvent().fire(new UnDeployDeployment(container, d));
log.info("Automatic undeploying of the managed deployment with name " + d.getDescription().getName() + " from the container with name " + container.getName()); getContainerControllerEvent().fire(new UnDeployDeployment(container, d));