public Set<ProtocolDescription> protocols() { Set<ProtocolDescription> protocols = new HashSet<ProtocolDescription>(); for (Deployment dep : deployments) { protocols.add(dep.getDescription().getProtocol()); } return protocols; }
public Set<ProtocolDescription> protocols() { Set<ProtocolDescription> protocols = new HashSet<ProtocolDescription>(); for (Deployment dep : deployments) { protocols.add(dep.getDescription().getProtocol()); } return protocols; }
public Set<TargetDescription> targets() { Set<TargetDescription> targets = new HashSet<TargetDescription>(); for (Deployment dep : deployments) { targets.add(dep.getDescription().getTarget()); } return targets; }
public Set<TargetDescription> targets() { Set<TargetDescription> targets = new HashSet<TargetDescription>(); for (Deployment dep : deployments) { targets.add(dep.getDescription().getTarget()); } return targets; }
public int compare(Deployment o1, Deployment o2) { return new Integer(o2.getDescription().getOrder()).compareTo(o1.getDescription().getOrder()); } });
private List<Deployment> findMatchingDeployments(DeploymentTargetDescription target) { List<Deployment> matching = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { if (deployment.getDescription().getName().equals(target.getName())) { matching.add(deployment); } } return matching; }
private List<Deployment> findMatchingDeployments(DeploymentTargetDescription target) { List<Deployment> matching = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { if (deployment.getDescription().getName().equals(target.getName())) { matching.add(deployment); } } return matching; }
private void contains(Collection<org.jboss.arquillian.container.spi.client.deployment.Deployment> deployments, String name) { if (deployments == null || deployments.size() == 0) { Assert.fail("No deployment by name " + name + " found in scenario. Scenario is empty"); } for (org.jboss.arquillian.container.spi.client.deployment.Deployment deployment : deployments) { if (name.equals(deployment.getDescription().getName())) { return; } } Assert.fail("No deployment by name " + name + " found in scenario. " + deployments); }
private void contains(Collection<org.jboss.arquillian.container.spi.client.deployment.Deployment> deployments, String name) { if (deployments == null || deployments.size() == 0) { Assert.fail("No deployment by name " + name + " found in scenario. Scenario is empty"); } for (org.jboss.arquillian.container.spi.client.deployment.Deployment deployment : deployments) { if (name.equals(deployment.getDescription().getName())) { return; } } Assert.fail("No deployment by name " + name + " found in scenario. " + deployments); }
@Before public void bindDeployment() { bind(ApplicationScoped.class, Deployment.class, deployment); bind(ApplicationScoped.class, DeploymentDescription.class, deploymentDescriptor); when(deployment.getDescription()).thenReturn(deploymentDescriptor); when(deployment.isDeployed()).thenReturn(true); }
@Before public void bindDeployment() { bind(ApplicationScoped.class, Deployment.class, deployment); bind(ApplicationScoped.class, DeploymentDescription.class, deploymentDescriptor); when(deployment.getDescription()).thenReturn(deploymentDescriptor); when(deployment.isDeployed()).thenReturn(true); }
private void forEachDeployment(List<Deployment> deployments, Operation<Container, Deployment> operation) throws Exception { injector.get().inject(operation); ContainerRegistry containerRegistry = this.containerRegistry.get(); if (containerRegistry == null) { return; } for (Deployment deployment : deployments) { Container container = containerRegistry.getContainer(deployment.getDescription().getTarget()); operation.perform(container, deployment); } }
private void forEachDeployment(List<Deployment> deployments, Operation<Container, Deployment> operation) throws Exception { injector.get().inject(operation); ContainerRegistry containerRegistry = this.containerRegistry.get(); if (containerRegistry == null) { return; } for (Deployment deployment : deployments) { Container container = containerRegistry.getContainer(deployment.getDescription().getTarget()); operation.perform(container, deployment); } }
@Test public void shouldDefaultToSingleDescriptor() { DeploymentDescription deployment = new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)); deployment.setTarget(TargetDescription.DEFAULT); DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment(deployment); DeploymentDescription defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT).getDescription(); Assert.assertEquals(deployment, defaultDeployment); }
@Test public void shouldDefaultToSingleDescriptor() { DeploymentDescription deployment = new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)); deployment.setTarget(TargetDescription.DEFAULT); DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment(deployment); DeploymentDescription defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT).getDescription(); Assert.assertEquals(deployment, defaultDeployment); }
@Test public void shouldDefaultToArchiveWhenDescriptorIsPresent() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); DeploymentDescription defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT).getDescription(); Assert.assertEquals("A", defaultDeployment.getName()); }
@Test public void shouldNotGetDefaultWithNonDefaultName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); DeploymentDescription deployment = scenario.deployment(new DeploymentTargetDescription("B")).getDescription(); Assert.assertEquals("B", deployment.getName()); }
@Test public void shouldNotGetDefaultWithNonDefaultName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); DeploymentDescription deployment = scenario.deployment(new DeploymentTargetDescription("B")).getDescription(); Assert.assertEquals("B", deployment.getName()); }
@Test public void shouldAddAdditionalObserverClasses() { addContainer("test-contianer").getContainerConfiguration().setMode("suite"); addProtocol(PROTOCOL_NAME_1, true); fire(createEvent(DeploymentWithObserver.class)); DeploymentScenario scenario = getManager().resolve(DeploymentScenario.class); Archive<?> archive = scenario.deployments().get(0).getDescription().getArchive(); verifyThatIsContainedInArchive(archive, DeploymentWithObserver.class); verifyThatIsContainedInArchive(archive, ObserverClass.class); verifyThatIsContainedInArchive(archive, SecondObserverClass.class); }
@Test public void shouldAddAdditionalObserverClasses() { addContainer("test-contianer").getContainerConfiguration().setMode("suite"); addProtocol(PROTOCOL_NAME_1, true); fire(createEvent(DeploymentWithObserver.class)); DeploymentScenario scenario = getManager().resolve(DeploymentScenario.class); Archive<?> archive = scenario.deployments().get(0).getDescription().getArchive(); verifyThatIsContainedInArchive(archive, DeploymentWithObserver.class); verifyThatIsContainedInArchive(archive, ObserverClass.class); verifyThatIsContainedInArchive(archive, SecondObserverClass.class); }