@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 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 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); }
private void setupAndExecuteUnDeployment(String containerName, boolean managed) { DeploymentDescription description = createDeploymentDescription(containerName) .shouldBeManaged(managed); scenario.get().addDeployment(description); controller.get().start(containerName); scenario.get().deployment(new DeploymentTargetDescription(DEPLOYMENT_NAME)).deployed(); controller.get().stop(containerName); }
private void setupAndExecuteUnDeployment(String containerName, boolean managed) { DeploymentDescription description = createDeploymentDescription(containerName) .shouldBeManaged(managed); scenario.get().addDeployment(description); controller.get().start(containerName); scenario.get().deployment(new DeploymentTargetDescription(DEPLOYMENT_NAME)).deployed(); controller.get().stop(containerName); }
@Test // checks same as shouldAllowMultipleDeploymentWithSameNameOfDifferentType but added in different order public void shouldAllowMultipleDeploymentWithSameNameOfDifferentTypeOrderIrrelevant() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); Deployment deployment = scenario.deployment(new DeploymentTargetDescription("A")); // will default to Archive Assert.assertEquals("A", deployment.getDescription().getName()); Assert.assertTrue(deployment.getDescription().isArchiveDeployment()); }
@Test public void shouldDefaultToDefaultWithMultipleDeployments() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); Deployment defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT); Assert.assertNotNull(defaultDeployment); Assert.assertEquals(DEFAULT_NAME, defaultDeployment.getDescription().getName()); Assert.assertTrue(defaultDeployment.getDescription().isArchiveDeployment()); }
@Test public void shouldAllowMultipleDeploymentWithSameNameOfDifferentType() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("A", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); Deployment deployment = scenario.deployment(new DeploymentTargetDescription("A")); // will default to Archive Assert.assertEquals("A", deployment.getDescription().getName()); Assert.assertTrue(deployment.getDescription().isArchiveDeployment()); }
@Test public void shouldDefaultToDefaultWithMultipleDeployments() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription(DEFAULT_NAME, ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); Deployment defaultDeployment = scenario.deployment(DeploymentTargetDescription.DEFAULT); Assert.assertNotNull(defaultDeployment); Assert.assertEquals(DEFAULT_NAME, defaultDeployment.getDescription().getName()); Assert.assertTrue(defaultDeployment.getDescription().isArchiveDeployment()); }
@Test public void shouldAllowMultipleDeploymentWithSameNameOfDifferentType() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("A", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); Deployment deployment = scenario.deployment(new DeploymentTargetDescription("A")); // will default to Archive Assert.assertEquals("A", deployment.getDescription().getName()); Assert.assertTrue(deployment.getDescription().isArchiveDeployment()); }
@Test // checks same as shouldAllowMultipleDeploymentWithSameNameOfDifferentType but added in different order public void shouldAllowMultipleDeploymentWithSameNameOfDifferentTypeOrderIrrelevant() { DeploymentScenario scenario = new DeploymentScenario(); scenario.addDeployment( new DeploymentDescription("A", Descriptors.create(BeansDescriptor.class)) .setTarget(TargetDescription.DEFAULT)); scenario.addDeployment( new DeploymentDescription("A", ShrinkWrap.create(JavaArchive.class)) .setTarget(TargetDescription.DEFAULT)); Deployment deployment = scenario.deployment(new DeploymentTargetDescription("A")); // will default to Archive Assert.assertEquals("A", deployment.getDescription().getName()); Assert.assertTrue(deployment.getDescription().isArchiveDeployment()); }