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

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


         @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)
            {
               deployment.deployedWithError(e);
               throw e;
            }
           
            deployEvent.fire(new AfterDeploy(deployableContainer, deploymentDescription));
            return null;
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();
            }
           
            deployEvent.fire(new AfterUnDeploy(deployableContainer, description));
            return null;
         }
View Full Code Here

      {
         return contextMap.remove(archive);
      }
      else
      {
         Deployment deployment = new Deployment(
               new DeploymentDescription("NO-NAME", archive));
         contextMap.put(archive, deployment);

         return deployment;
      }
View Full Code Here

      if(registry == null)
      {
         throw new IllegalArgumentException("No container registry in context");
      }
     
      Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name));
      if(deployment == null)
      {
         throw new IllegalArgumentException("No deployment in context found with name " + name);
      }
     
      if (deployment.getDescription().managed())
      {
         throw new IllegalArgumentException("Could not deploy " + name + " deployment. The deployment is controlled by Arquillian");
      }
     
      Container container = registry.getContainer(deployment.getDescription().getTarget());
     
      if (!container.getState().equals(State.STARTED))
      {
         throw new IllegalArgumentException("Deployment with name " + name + " could not be deployed. Container " +
            container.getName() + " must be started first.");
View Full Code Here

      if(registry == null)
      {
         throw new IllegalArgumentException("No container registry in context");
      }
     
      Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name));
      if(deployment == null)
      {
         throw new IllegalArgumentException("No deployment in context found with name " + name);
      }
     
      if (deployment.getDescription().managed())
      {
         throw new IllegalArgumentException("Could not deploy " + name + " deployment. The deployment is controlled by Arquillian");
      }
     
      Container container = registry.getContainer(deployment.getDescription().getTarget());
     
      if (!container.getState().equals(State.STARTED))
      {
         throw new IllegalArgumentException("Deployment with name " + name + " could not be undeployed. Container " +
            container.getName() + " must be still running.");
View Full Code Here

      DeploymentScenario scenario = deploymentScenario.get();
      if(scenario == null)
      {
         throw new IllegalArgumentException("No deployment scenario in context");
      }
      Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name));
      if(deployment == null)
      {
         throw new IllegalArgumentException("No deployment in context found with name " + name);
      }

      DeploymentDescription description = deployment.getDescription();
      if(description.isArchiveDeployment())
      {
         Archive<?> archive = description.testable() ? description.getTestableArchive():description.getArchive();
         return archive.as(ZipExporter.class).exportAsInputStream();
      }
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)
            {
               deployment.deployedWithError(e);
               throw e;
            }
           
            deployEvent.fire(new AfterDeploy(deployableContainer, deploymentDescription));
            return null;
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();
            }
           
            deployEvent.fire(new AfterUnDeploy(deployableContainer, description));
            return null;
         }
View Full Code Here

      Mockito.when(registry.getContainer(
            new TargetDescription("X"))).thenReturn(new ContainerImpl("X", deployableContainer, new ContainerDefImpl("X")));
      Mockito.when(registry.getContainer(
            new TargetDescription("Z"))).thenReturn(new ContainerImpl("Z", deployableContainer, new ContainerDefImpl("Z")));

      Deployment deploymentZ = new Deployment(new DeploymentDescription("Z", ShrinkWrap.create(JavaArchive.class))
                                                   .setTarget(new TargetDescription("Z")));
      Deployment deploymentX = new Deployment(new DeploymentDescription("X", ShrinkWrap.create(JavaArchive.class))
                                                   .setTarget(new TargetDescription("X")));

      Mockito.when(scenario.deployment(new DeploymentTargetDescription("Z"))).thenReturn(deploymentZ);
      Mockito.when(scenario.deployment(new DeploymentTargetDescription("X"))).thenReturn(deploymentX);

      ContainerContext containerContext = getManager().getContext(ContainerContext.class);
      DeploymentContext deploymentContext = getManager().getContext(DeploymentContext.class);
      try
      {
         deploymentContext.activate(deploymentX);
         deploymentContext.getObjectStore().add(contextualType, innerType);
         deploymentContext.deactivate();

         /*
          *  deploymentZ is left active and should be handled as 'current'.
          *  The test is to see if the Enricher with Qualifier can activate/deactive and read from X
          */
         deploymentContext.activate(deploymentZ);
         deploymentContext.getObjectStore().add(contextualType, outerType);

         containerContext.activate("TEST");

         TestEnricher enricher = new ArquillianResourceTestEnricher();
         injector.get().inject(enricher);

         X test = enrichType.cast(enrichType.newInstance());
         enricher.enrich(test);

         return test;
      }
      catch (RuntimeException e)
      {
         throw (Exception)e.getCause();
      }
      finally
      {
         if(deploymentContext.isActive())
         {
            Deployment activeContext = deploymentContext.getActiveId();
            if(!"Z".equals(activeContext.getDescription().getName()))
            {
               Assert.fail("Wrong deployment context active, potential leak in Enricher. Active context was " + activeContext.getDescription().getName());
            }
         }
         if(containerContext.isActive())
         {
            String activeContext = containerContext.getActiveId();
View Full Code Here

TOP

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

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.