Package org.jboss.arquillian.container.spi.client.deployment

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


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


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

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

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

   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(deployment.getDescription(), applicationArchive, auxiliaryArchives),
                     serviceLoader.get().all(ProtocolArchiveProcessor.class)));
      }
   }
View Full Code Here

            if (Annotations.isAnnotationPresent(deploymentMethod, DeployToRepository.class))
               remoteAddon.setAddonRepository(Annotations.getAnnotation(deploymentMethod, DeployToRepository.class)
                        .value());

            DeploymentDescription deploymentDescription = new DeploymentDescription(id.toCoordinates(), remoteAddon);
            deploymentDescription.shouldBeTestable(false);
            deployments.add(deploymentDescription);
         }

      return deployments;
   }
View Full Code Here

   {
      TargetDescription target = generateTarget(deploymentMethod);
      ProtocolDescription protocol = generateProtocol(deploymentMethod);

      Deployment deploymentAnnotation = deploymentMethod.getAnnotation(Deployment.class);
      DeploymentDescription description = null;
      if (Archive.class.isAssignableFrom(deploymentMethod.getReturnType()))
      {
         Archive<?> archive = invoke(Archive.class, deploymentMethod);
         if (archive instanceof RepositoryForgeArchive)
         {
            if (Annotations.isAnnotationPresent(deploymentMethod, DeployToRepository.class))
               ((RepositoryForgeArchive) archive).setAddonRepository(Annotations.getAnnotation(deploymentMethod,
                        DeployToRepository.class).value());
         }
         description = new DeploymentDescription(deploymentAnnotation.name(), archive);
         description.shouldBeTestable(deploymentAnnotation.testable());
      }
      else if (Descriptor.class.isAssignableFrom(deploymentMethod.getReturnType()))
      {
         description = new DeploymentDescription(deploymentAnnotation.name(),
                  invoke(Descriptor.class, deploymentMethod));
      }
      description.shouldBeManaged(deploymentAnnotation.managed());
      description.setOrder(deploymentAnnotation.order());

      if (target != null)
      {
         description.setTarget(target);
      }
      if (protocol != null)
      {
         description.setProtocol(protocol);
      }

      if (deploymentMethod.isAnnotationPresent(ShouldThrowException.class))
      {
         description.setExpectedException(deploymentMethod.getAnnotation(ShouldThrowException.class).value());
      }

      return description;
   }
View Full Code Here


   public void execute(@Observes RemoteExecutionEvent event) throws Exception
   {
      Container container = this.container.get();
      DeploymentDescription deployment = this.deployment.get();
     
      ProtocolRegistry protoReg = protocolRegistry.get();

      // if no default marked or specific protocol defined in the registry, use the DeployableContainers defaultProtocol.
      ProtocolDefinition protocol = protoReg.getProtocol(deployment.getProtocol());
      if(protocol == null)
      {
         protocol = protoReg.getProtocol(container.getDeployableContainer().getDefaultProtocol());
      }
   
View Full Code Here

         @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

         @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

TOP

Related Classes of org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription

Copyright © 2018 www.massapicom. 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.