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

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;
         }
         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


     * Verifies that deployments for Warp tests are all testable
     */
    public void verifyWarpDeployment(@Observes DeploymentScenario deploymentScenario) {
        if (WarpCommons.isWarpTest(testClass.get().getJavaClass())) {
            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

   @Inject
   private Instance<ServiceLoader> serviceLoader;
  
   public void verifyExpectedExceptionDuringDeploy(@Observes EventContext<DeployDeployment> context) throws Exception
   {
      DeploymentDescription deployment = context.getEvent().getDeployment().getDescription();
      boolean deploymentExceptionThrown = true;
      try
      {
         context.proceed();
         if(deployment.getExpectedException() != null)
         {
            deploymentExceptionThrown = false;
            throw new RuntimeException(
                  "Expected exception of type " + deployment.getExpectedException().getName() + " during deployment of " +
                  deployment.getName() + ", but no exception was thrown.");
         }
      }
      catch (Exception e)
      {
         // if exception is not thrown from the deployment, rethrow it (we threw it).
         if(!deploymentExceptionThrown)
         {
            throw e;
         }
         if(deployment.getExpectedException() != null)
         {
            if(!containsType(
                  transform(e),
                  deployment.getExpectedException()))
            {
               throw e;
            }
         }
         else
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

      Assert.assertNotNull(scenario);
      Assert.assertEquals(
            "Verify all deployments were found",
            1, scenario.size());

      DeploymentDescription deploymentOne = scenario.get(0);

      Assert.assertEquals(false, deploymentOne.testable());
      Assert.assertTrue(Validate.isArchiveOfType(JavaArchive.class, deploymentOne.getArchive()));
      Assert.assertEquals(Exception.class, deploymentOne.getExpectedException());
   }
View Full Code Here

      setupAndExecuteUnDeployment(containerName, false);
   }

   private void setupAndExecuteDeployment(String containerName, boolean managed)
   {
      DeploymentDescription description = createDeploymentDescription(containerName)
                               .shouldBeManaged(managed);

      scenario.get().addDeployment(description);
      controller.get().start(containerName);
      controller.get().start(containerName, new Config().add("managementPort", "19999").map());
View Full Code Here

      controller.get().start(containerName, new Config().add("managementPort", "19999").map());
   }

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

      controller.get().stop(containerName);
   }

   private DeploymentDescription createDeploymentDescription(String targetName)
   {
      return new DeploymentDescription(DEPLOYMENT_NAME, ShrinkWrap.create(JavaArchive.class))
               .setTarget(new TargetDescription(targetName));
   }
View Full Code Here

   }

   @Test
   public void shouldFireDeploymentEventOnDeploy() throws Exception
   {
      DeploymentDescription description = new DeploymentDescription(DEPLOYMENT_NAME, ShrinkWrap.create(JavaArchive.class));
      description.shouldBeManaged(false);
      description.setTarget(new TargetDescription("_DEFAULT_"));
      scenario.get().addDeployment(description);
     
      deployer.get().deploy(DEPLOYMENT_NAME);
     
      assertEventFired(DeployDeployment.class, 1);
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.