public List<Deployment> managedDeploymentsInDeployOrder() { List<Deployment> managedDeployment = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { DeploymentDescription desc = deployment.getDescription(); if (desc.managed()) { managedDeployment.add(deployment); } } Collections.sort(managedDeployment, new Comparator<Deployment>() { public int compare(Deployment o1, Deployment o2) { return new Integer(o1.getDescription().getOrder()).compareTo(o2.getDescription().getOrder()); } }); return Collections.unmodifiableList(managedDeployment); }
public List<Deployment> managedDeploymentsInDeployOrder() { List<Deployment> managedDeployment = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { DeploymentDescription desc = deployment.getDescription(); if (desc.managed()) { managedDeployment.add(deployment); } } Collections.sort(managedDeployment, new Comparator<Deployment>() { public int compare(Deployment o1, Deployment o2) { return new Integer(o1.getDescription().getOrder()).compareTo(o2.getDescription().getOrder()); } }); return Collections.unmodifiableList(managedDeployment); }
/** * Filters the List of Deployments and returns the ones that are Managed deployments. * * @param deployments * List to filter * * @return Filtered list */ private List<Deployment> managedDeployments(List<Deployment> deployments) { List<Deployment> managed = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { if (deployment.getDescription().managed()) { managed.add(deployment); } } return managed; }
/** * Filters the List of Deployments and returns the ones that are Managed deployments. * * @param deployments * List to filter * * @return Filtered list */ private List<Deployment> managedDeployments(List<Deployment> deployments) { List<Deployment> managed = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { if (deployment.getDescription().managed()) { managed.add(deployment); } } return managed; }
public List<Deployment> deployedDeploymentsInUnDeployOrder() { List<Deployment> managedDeployment = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { DeploymentDescription desc = deployment.getDescription(); if (desc.managed() || deployment.isDeployed()) { managedDeployment.add(deployment); } } Collections.sort(managedDeployment, new Comparator<Deployment>() { public int compare(Deployment o1, Deployment o2) { return new Integer(o2.getDescription().getOrder()).compareTo(o1.getDescription().getOrder()); } }); return Collections.unmodifiableList(managedDeployment); }
public List<Deployment> deployedDeploymentsInUnDeployOrder() { List<Deployment> managedDeployment = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { DeploymentDescription desc = deployment.getDescription(); if (desc.managed() || deployment.isDeployed()) { managedDeployment.add(deployment); } } Collections.sort(managedDeployment, new Comparator<Deployment>() { public int compare(Deployment o1, Deployment o2) { return new Integer(o2.getDescription().getOrder()).compareTo(o1.getDescription().getOrder()); } }); return Collections.unmodifiableList(managedDeployment); }
/** * Get all {@link DeploymentDescription} defined to be deployed during Test startup for a specific {@link * TargetDescription} ordered. * * @param target * The Target to filter on * * @return A List of found {@link DeploymentDescription}. Will return a empty list if none are found. */ public List<Deployment> startupDeploymentsFor(TargetDescription target) { Validate.notNull(target, "Target must be specified"); List<Deployment> startupDeployments = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { DeploymentDescription desc = deployment.getDescription(); if (desc.managed() && target.equals(desc.getTarget())) { startupDeployments.add(deployment); } } // sort them by order Collections.sort(startupDeployments, new Comparator<Deployment>() { public int compare(Deployment o1, Deployment o2) { return new Integer(o1.getDescription().getOrder()).compareTo(o2.getDescription().getOrder()); } }); return Collections.unmodifiableList(startupDeployments); }
/** * Get all {@link DeploymentDescription} defined to be deployed during Test startup for a specific {@link * TargetDescription} ordered. * * @param target * The Target to filter on * * @return A List of found {@link DeploymentDescription}. Will return a empty list if none are found. */ public List<Deployment> startupDeploymentsFor(TargetDescription target) { Validate.notNull(target, "Target must be specified"); List<Deployment> startupDeployments = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { DeploymentDescription desc = deployment.getDescription(); if (desc.managed() && target.equals(desc.getTarget())) { startupDeployments.add(deployment); } } // sort them by order Collections.sort(startupDeployments, new Comparator<Deployment>() { public int compare(Deployment o1, Deployment o2) { return new Integer(o1.getDescription().getOrder()).compareTo(o2.getDescription().getOrder()); } }); return Collections.unmodifiableList(startupDeployments); }
@Override public void deploy(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 deployed. Container " + container.getName() + " must be started first."); } event.fire(new DeployDeployment(container, deployment)); }
@Override public void deploy(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 deployed. Container " + container.getName() + " must be started first."); } event.fire(new DeployDeployment(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)); }
if (d.getDescription().managed() && "custom".equalsIgnoreCase( container.getContainerConfiguration().getMode())) { throw new IllegalStateException(
if (d.getDescription().managed() && "custom".equalsIgnoreCase( container.getContainerConfiguration().getMode())) { throw new IllegalStateException(
@Override public List<DeploymentDescription> generate(TestClass testClass) { List<DeploymentDescription> deployments = super.generate(testClass); List<DeploymentDescription> updatedDeployments = new ArrayList<DeploymentDescription>(); for (DeploymentDescription currentDeploymentDescription : deployments) { if (currentDeploymentDescription.getArchive() instanceof PortletArchive) { DeploymentDescription newDescription = new DeploymentDescription(currentDeploymentDescription.getName(), currentDeploymentDescription.getArchive().as(WebArchive.class)); newDescription.shouldBeTestable(currentDeploymentDescription.testable()) .shouldBeManaged(currentDeploymentDescription.managed()) .setOrder(currentDeploymentDescription.getOrder()) .setTarget(currentDeploymentDescription.getTarget()) .setProtocol(currentDeploymentDescription.getProtocol()) .setExpectedException(currentDeploymentDescription.getExpectedException()); updatedDeployments.add(newDescription); } else { updatedDeployments.add(currentDeploymentDescription); } } return updatedDeployments; } }
Container container = conReg.getContainer(deployment.getDescription().getTarget()); if ("custom".equalsIgnoreCase(container.getContainerConfiguration().getMode())) { if (deployment.getDescription().managed()) { throw new ValidationException( "Deployment "
Container container = conReg.getContainer(deployment.getDescription().getTarget()); if ("custom".equalsIgnoreCase(container.getContainerConfiguration().getMode())) { if (deployment.getDescription().managed()) { throw new ValidationException( "Deployment "
@Test public void shouldHandleMultipleDeploymentsAllDefault() throws Exception { List<DeploymentDescription> scenario = generate(MultiDeploymentsDefault.class); Assert.assertNotNull(scenario); Assert.assertEquals( "Verify all deployments were found", 2, scenario.size()); for (DeploymentDescription deployment : scenario) { Assert.assertEquals( "Verify deployment has default target", TargetDescription.DEFAULT, deployment.getTarget()); Assert.assertEquals( "Verify deployment has default protocol", ProtocolDescription.DEFAULT, deployment.getProtocol()); Assert.assertEquals(-1, deployment.getOrder()); Assert.assertEquals(true, deployment.managed()); Assert.assertTrue(Validate.isArchiveOfType(JavaArchive.class, deployment.getArchive())); } }
@Test public void shouldHandleMultipleDeploymentsAllDefault() throws Exception { List<DeploymentDescription> scenario = generate(MultiDeploymentsDefault.class); Assert.assertNotNull(scenario); Assert.assertEquals( "Verify all deployments were found", 2, scenario.size()); for (DeploymentDescription deployment : scenario) { Assert.assertEquals( "Verify deployment has default target", TargetDescription.DEFAULT, deployment.getTarget()); Assert.assertEquals( "Verify deployment has default protocol", ProtocolDescription.DEFAULT, deployment.getProtocol()); Assert.assertEquals(-1, deployment.getOrder()); Assert.assertEquals(true, deployment.managed()); Assert.assertTrue(Validate.isArchiveOfType(JavaArchive.class, deployment.getArchive())); } }
Assert.assertEquals(false, deploymentDesc.managed()); Assert.assertEquals(false, deploymentDesc.testable()); Assert.assertTrue(Validate.isArchiveOfType(JavaArchive.class, deploymentDesc.getArchive())); Assert.assertEquals(false, deploymentDesc.managed()); Assert.assertEquals(true, deploymentDesc.testable()); Assert.assertTrue(Validate.isArchiveOfType(JavaArchive.class, deploymentDesc.getArchive()));