@Test(expected = IllegalArgumentException.class) public void shouldNotAllowMultipleArchiveDeploymentsWithSameName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("X", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("X", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); }
@Test(expected = IllegalArgumentException.class) public void shouldNotAllowMultipleArchiveDeploymentsWithSameName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("X", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("X", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); }
@Test(expected = IllegalArgumentException.class) public void shouldNotAllowMultipleArchiveDeploymentsWithSameArchiveName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(TargetDescription.DEFAULT)); }
@Test(expected = IllegalArgumentException.class) public void shouldNotAllowMultipleArchiveDeploymentsWithSameArchiveName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(TargetDescription.DEFAULT)); }
@Test public void shouldAllowMultipleArchiveDeploymentsWithSameArchiveNameWithDifferentTargets() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(new TargetDescription("B"))); Assert.assertEquals(2, scenario.deployments().size()); }
@Test public void shouldAllowMultipleArchiveDeploymentsWithSameArchiveNameWithDifferentTargets() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", ShrinkWrap.create(JavaArchive.class, "test.jar")) .setTarget(new TargetDescription("B"))); Assert.assertEquals(2, scenario.deployments().size()); }
public void generateDeployment(@Observes GenerateDeployment event) { final Collection<DeploymentScenarioGenerator> deploymentScenarioGenerators = serviceLoader.get().all(DeploymentScenarioGenerator.class); DeploymentScenario scenario = new DeploymentScenario(); for (DeploymentScenarioGenerator generator : deploymentScenarioGenerators) { for (DeploymentDescription deployment : generator.generate(event.getTestClass())) { scenario.addDeployment(deployment); } } validate(scenario); createTestableDeployments(scenario, event.getTestClass()); deployment.set(scenario); }
@Test public void shouldNotDefaultWhenMultipleArchives() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); Deployment defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT); Assert.assertNull(defaultDeployment); }
@Test public void shouldNotDefaultWhenMultipleArchives() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); Deployment defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT); Assert.assertNull(defaultDeployment); }
@Test public void shouldNotGetWithUnknownName() { 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)); Deployment deployment = scenario.deployment(new DeploymentTargetDescription("C")); Assert.assertNull(deployment); }
@Test public void shouldNotGetWithUnknownName() { 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)); Deployment deployment = scenario.deployment(new DeploymentTargetDescription("C")); Assert.assertNull(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(expected = IllegalArgumentException.class) public void shouldNotAllowMultipleDescriptorDeploymentsWithSameName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); } }
@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(expected = IllegalArgumentException.class) public void shouldNotAllowMultipleDescriptorDeploymentsWithSameName() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); } }
@Test public void shouldNotDefaultWhenMultipleDescriptors() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); Deployment defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT); Assert.assertNull(defaultDeployment); }
@Test public void shouldNotDefaultWhenMultipleDescriptors() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("B", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); Deployment defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT); Assert.assertNull(defaultDeployment); }