Examples of DeploymentDescription


Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

   {
      TargetDescription target = generateTarget(deploymentMethod);
      ProtocolDescription protocol = generateProtocol(deploymentMethod);
     
      Deployment deploymentAnnotation = deploymentMethod.getAnnotation(Deployment.class);
      DeploymentDescription deployment = null;
      if(Archive.class.isAssignableFrom(deploymentMethod.getReturnType()))
      {
         deployment = new DeploymentDescription(deploymentAnnotation.name(), invoke(Archive.class, deploymentMethod));
         logWarningIfArchiveHasUnexpectedFileExtension(deployment);
         deployment.shouldBeTestable(deploymentAnnotation.testable());
      }
      else if(Descriptor.class.isAssignableFrom(deploymentMethod.getReturnType()))
      {
         deployment = new DeploymentDescription(deploymentAnnotation.name(), invoke(Descriptor.class, deploymentMethod));
         //deployment.shouldBeTestable(false);
      }
      deployment.shouldBeManaged(deploymentAnnotation.managed());
      deployment.setOrder(deploymentAnnotation.order());
      if(target != null)
      {
         deployment.setTarget(target);
      }
      if(protocol != null)
      {
         deployment.setProtocol(protocol);
      }
     
      if(deploymentMethod.isAnnotationPresent(ShouldThrowException.class))
      {
         deployment.setExpectedException(deploymentMethod.getAnnotation(ShouldThrowException.class).value());
         deployment.shouldBeTestable(false); // can't test against failing deployments
      }
     
      return deployment;
   }
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

     * Verifies that deployments for Warp tests are all testable
     */
    public void verifyWarpDeployment(@Observes DeploymentScenario deploymentScenario) {
        if (testClass.get().getJavaClass().getAnnotation(WarpTest.class) != null) {
            for (Deployment deployment : deploymentScenario.deployments()) {
                DeploymentDescription description = deployment.getDescription();
                if (!description.testable()) {
                    throw new IllegalArgumentException("Warp deployments must be testable: " + testClass.get().getJavaClass()
                            + " - check that you have @Deployment(testable=true)");
                }
            }
        }
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

        fire(new After(instance, testDummyMethodWithParameters));

        assertEventFired(BeforeDroneDestroyed.class, 1);
        assertEventFired(AfterDroneDestroyed.class, 1);

        fire(new BeforeUnDeploy(Mockito.mock(DeployableContainer.class), new DeploymentDescription(DEPLOYMENT_NAME,
                Mockito.mock(JavaArchive.class))));

        assertEventFired(BeforeDroneDestroyed.class, 2);
        assertEventFired(AfterDroneDestroyed.class, 2);
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

   private void buildTestableDeployments(DeploymentScenario scenario, TestClass testCase, ProtocolRegistry protoReg)
   {
      for(Deployment deployment : scenario.deployments())
      {
         DeploymentDescription description = deployment.getDescription();
         if(!description.testable() || !description.isArchiveDeployment())
         {
            continue;
         }
         // TODO: could be optimalized to only be loaded pr Container
         List<Archive<?>> auxiliaryArchives = loadAuxiliaryArchives(description);
        
         ProtocolDefinition protocolDefinition = protoReg.getProtocol(description.getProtocol());
         if(protocolDefinition == null)
         {
            protocolDefinition = protoReg.getProtocol(
                  containerRegistry.get().getContainer(description.getTarget()).getDeployableContainer().getDefaultProtocol());
         }
         Protocol<?> protocol = protocolDefinition.getProtocol();
         DeploymentPackager packager = protocol.getPackager();

         Archive<?> applicationArchive = description.getArchive();
         applyApplicationProcessors(description.getArchive(), testCase);
         applyAuxiliaryProcessors(auxiliaryArchives);

         try
         {
            // this should be made more reliable, does not work with e.g. a EnterpriseArchive
            if(ClassContainer.class.isInstance(applicationArchive))
            {
               ClassContainer<?> classContainer = ClassContainer.class.cast(applicationArchive);
               classContainer.addClass(testCase.getJavaClass());
            }
         }
         catch (UnsupportedOperationException e)
         {
            /*
             * Quick Fix: https://jira.jboss.org/jira/browse/ARQ-118
             * Keep in mind when rewriting for https://jira.jboss.org/jira/browse/ARQ-94
             * that a ShrinkWrap archive might not support a Container if even tho the
             * ContianerBase implements it. Check the Archive Interface.. 
             */
         }
         description.setTestableArchive(
               packager.generateDeployment(
                     new TestDeployment(applicationArchive, auxiliaryArchives),
                     serviceLoader.get().all(ProtocolArchiveProcessor.class)));
      }
   }
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

         @Override
         public Void call() throws Exception
         {
            DeployableContainer<?> deployableContainer = event.getDeployableContainer();
            Deployment deployment = event.getDeployment();
            DeploymentDescription deploymentDescription = deployment.getDescription();
           
            /*
             * TODO: should the DeploymentDescription producer some how be automatically registered ?
             * Or should we just 'know' who is the first one to create the context
             */
            deploymentDescriptionProducer.set(deploymentDescription);
            deploymentProducer.set(deployment);
           
            deployEvent.fire(new BeforeDeploy(deployableContainer, deploymentDescription));

            try
            {
               if(deploymentDescription.isArchiveDeployment())
               {
                  protocolMetadata.set(deployableContainer.deploy(
                        deploymentDescription.getTestableArchive() != null ? deploymentDescription.getTestableArchive():deploymentDescription.getArchive()));
               }
               else
               {
                  deployableContainer.deploy(deploymentDescription.getDescriptor());
               }
               deployment.deployed();
            }
            catch (Exception e)
            {
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

         @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();
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

      when(serviceLoader.onlyOne(eq(DeployableContainer.class))).thenReturn(deployableContainer1, deployableContainer2);
      when(container1.getContainerName()).thenReturn(CONTAINER_1_NAME);
      when(container2.getContainerName()).thenReturn(CONTAINER_2_NAME);
     
      scenario.addDeployment(
            new DeploymentDescription(DEPLOYMENT_1_NAME, ShrinkWrap.create(JavaArchive.class))
               .setTarget(new TargetDescription(CONTAINER_1_NAME))
               .shouldBeTestable(false)
               .setOrder(2));
     
      // should use testable archive
      scenario.addDeployment(
            new DeploymentDescription(DEPLOYMENT_2_NAME, ShrinkWrap.create(JavaArchive.class))
               .setTarget(new TargetDescription(CONTAINER_2_NAME))
               .setOrder(1)
               .shouldBeTestable(true)
               .setTestableArchive(ShrinkWrap.create(JavaArchive.class)));
     
      // should not be deployed during Managed deployments
      scenario.addDeployment(
            new DeploymentDescription(DEPLOYMENT_3_NAME, ShrinkWrap.create(JavaArchive.class))
               .setTarget(new TargetDescription(CONTAINER_2_NAME))
               .setOrder(3)
               .shouldBeTestable(false)
               .shouldBeManaged(false));
     
      scenario.addDeployment(
            new DeploymentDescription(DEPLOYMENT_4_NAME, Descriptors.create(BeansDescriptor.class))
               .setTarget(new TargetDescription(CONTAINER_1_NAME))
               .setOrder(4)
               .shouldBeManaged(true));
     
      registry = new LocalContainerRegistry(injector.get());
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

   public void shouldSwallowExceptionIfExpected() throws Exception
   {
      TestExceptionDeployThrower.shouldThrow = new DeploymentException("Could not handle ba", new NullPointerException());
      fire(new DeployDeployment(
            container,
            new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class))
               .setExpectedException(NullPointerException.class))));
   }
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

      TestExceptionDeployThrower.shouldThrow = new DeploymentException("Could not handle ba", new IllegalArgumentException());
      Mockito.when(serviceLoader.all(DeploymentExceptionTransformer.class)).thenReturn(Arrays.asList(transformer));

      fire(new DeployDeployment(
            container,
            new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class))
            .setExpectedException(IllegalArgumentException.class))));
     
      Mockito.verify(transformer, Mockito.times(1)).transform(Mockito.isA(Exception.class));
   }
View Full Code Here

Examples of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

      Mockito.when(serviceLoader.all(DeploymentExceptionTransformer.class)).thenReturn(Arrays.asList(transformer));
      Mockito.when(transformer.transform(TestExceptionDeployThrower.shouldThrow)).thenReturn(new IllegalArgumentException());

      fire(new DeployDeployment(
            container,
            new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class))
               .setExpectedException(IllegalArgumentException.class))));
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.