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

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


      Assert.assertNotNull(scenario);
      Assert.assertEquals(
            "Verify all deployments were found",
            2, scenario.getDeployments().size());
     
      DeploymentDescription deploymentOne = scenario.getDeployments().get(0);

      Assert.assertEquals(
            "Verify deployment has specified target",
            new TargetDescription("target-first"),
            deploymentOne.getTarget());

      Assert.assertEquals(
            "Verify deployment has specified protocol",
            new ProtocolDescription("protocol-first"),
            deploymentOne.getProtocol());
     
      Assert.assertEquals(1, deploymentOne.getOrder());
      Assert.assertEquals(false, deploymentOne.managed());
      Assert.assertEquals(false, deploymentOne.testable());
      Assert.assertTrue(JavaArchive.class.isInstance(deploymentOne.getArchive()));
      Assert.assertNull(deploymentOne.getExpectedException());
     
      DeploymentDescription deploymentTwo = scenario.getDeployments().get(1);

      Assert.assertEquals(
            "Verify deployment has specified target",
            new TargetDescription("target-second"),
            deploymentTwo.getTarget());
      Assert.assertEquals(
            "Verify deployment has specified protocol",
            new ProtocolDescription("protocol-second"),
            deploymentTwo.getProtocol());
     
      Assert.assertEquals(2, deploymentTwo.getOrder());
      Assert.assertEquals(false, deploymentTwo.managed());
      Assert.assertEquals(true, deploymentTwo.testable());
      Assert.assertTrue(JavaArchive.class.isInstance(deploymentTwo.getArchive()));
      Assert.assertNull(deploymentTwo.getExpectedException());
   }
View Full Code Here


      Assert.assertNotNull(scenario);
      Assert.assertEquals(
            "Verify all deployments were found",
            1, scenario.getDeployments().size());
     
      DeploymentDescription deploymentOne = scenario.getDeployments().get(0);

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

   @Inject
   private Instance<ServiceLoader> serviceLoader;
  
   public void verifyExpectedExceptionDuringDeploy(@Observes EventContext<DeployDeployment> context) throws Exception
   {
      DeploymentDescription deployment = context.getEvent().getDeployment();
      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();
            DeploymentDescription deployment = event.getDeployment();

            /*
             * TODO: should the DeploymentDescription producer some how be automatically registered ?
             * Or should we just 'know' who is the first one to create the context
             */
            deploymentDescription.set(deployment);
           
            deployEvent.fire(new BeforeDeploy(deployableContainer, deployment));

            if(deployment.isArchiveDeployment())
            {
               protocolMetadata.set(deployableContainer.deploy(
                     deployment.getTestableArchive() != null ? deployment.getTestableArchive():deployment.getArchive()));
            }
            else
            {
               deployableContainer.deploy(deployment.getDescriptor());
            }
           
            deployEvent.fire(new AfterDeploy(deployableContainer, deployment));
            return null;
         }
View Full Code Here

         @Override
         public Void call() throws Exception
         {
            DeployableContainer<?> deployableContainer = event.getDeployableContainer();
            DeploymentDescription deployment = event.getDeployment();
           
            deployEvent.fire(new BeforeUnDeploy(deployableContainer, deployment));

            if(deployment.isArchiveDeployment())
            {
               try
               {
                  deployableContainer.undeploy(
                        deployment.getTestableArchive() != null ? deployment.getTestableArchive():deployment.getArchive());
               }
               catch (Exception e)
               {
                  // TODO: Evaluate, should this be moved to DeploymentExceptionHandler?
                  // silently ignore UnDeploy exceptions if a expected exception during deploy(it is probably not deployed)
                  if(deployment.getExpectedException() == null)
                  {
                     throw e;
                  }
               }
            }
            else
            {
               deployableContainer.undeploy(deployment.getDescriptor());
            }
           
            deployEvent.fire(new AfterUnDeploy(deployableContainer, deployment));
            return null;
         }
View Full Code Here

   private InstanceProducer<TestResult> testResult;

   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

   @Inject
   private Instance<DeploymentDescription> deploymentDescription;

   public void execute(@Observes Test event) throws Exception
   {
      DeploymentDescription deploymentDescription = this.deploymentDescription.get();
     
      boolean runAsClient =  deploymentDescription.testable() ? false:true;
     
      if(event.getTestMethod().isAnnotationPresent(RunAsClient.class))
      {
         runAsClient = true;
      }
View Full Code Here

      DeploymentTargetDescription deploymentTarget = locateDeployment(method);
     
      ContainerRegistry containerRegistry = this.containerRegistry.get();
      DeploymentScenario deploymentScenario = this.deploymentScenario.get();
     
      DeploymentDescription deployment = deploymentScenario.getDeployment(deploymentTarget);
     
      Container container = containerRegistry.getContainer(deployment.getTarget());
     
      callback.call(container, deployment);
   }
View Full Code Here

   {
      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));
         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

TOP

Related Classes of org.jboss.arquillian.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.