Package org.jboss.arquillian.container.spi

Examples of org.jboss.arquillian.container.spi.Container


     * @return
     * @throws IllegalArgumentException If no ResourceProvider found for Type
     * @throws RuntimeException         If ResourceProvider return null
     */
    private Object lookup(Class<?> type, ContainerResource resource, Annotation... qualifiers) {
        final Container container;
        final List<Container> containers = containerRegistry.get().getContainers();
        if (resource.value().isEmpty()) {
            if (containers.size() > 1) {
                throw new RuntimeException("@ContainerResource did not specify a server and more than one server exists in the deployment");
            }
            container = containers.get(0);
        } else {
            container = containerRegistry.get().getContainer(resource.value());
            if (container == null) {
                throw new RuntimeException("@ContainerResource specified non existent server " + resource.value());
            }
        }
        try {
            containerContext.get().activate(container.getName());
            if (Context.class.isAssignableFrom(type)) {
                return lookupContext(type, resource, qualifiers);
            } else if (ManagementClient.class.isAssignableFrom(type)) {
                return managementClient.get();
            } else {
View Full Code Here


      {
         return;
      }
      for(Deployment deployment: deployments)
      {
         Container container = containerRegistry.getContainer(deployment.getDescription().getTarget());
         operation.perform(container, deployment);
      }
   }
View Full Code Here

   private Instance<ExecutorService> executorService;


   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());
      }
   
      ProtocolConfiguration protocolConfiguration;
     
      if(container.hasProtocolConfiguration(protocol.getProtocolDescription()))
      {
         protocolConfiguration = protocol.createProtocolConfiguration(
               container.getProtocolConfiguration(protocol.getProtocolDescription()).getProtocolProperties());
      }
      else
      {
         protocolConfiguration = protocol.createProtocolConfiguration();
      }
View Full Code Here

   protected void validate(DeploymentScenario scenario)
   {
      ContainerRegistry conReg = containerRegistry.get();
      for(TargetDescription target : scenario.targets())
      {
         Container container = conReg.getContainer(target);
         if(container == null)
         {
            throw new ValidationException(
                  DeploymentScenario.class.getSimpleName() + " contains targets not maching any defined Container in the registry. " + target.getName());
         }
View Full Code Here

        ContainerRegistry registry = containerRegistry.get();
        if (registry == null) {
            return;
        }
       
        Container container = null;
       
        if (target != null) {
            container = registry.getContainer(target);
        } else {           
        }
       
        if (container == null) {
            throw new IllegalArgumentException("Could not find a PluginContainer called '" + target.getName() + "'");           
        }
       
        try {
            PluginContainer pc = RhqAgentPluginContainer.switchPluginContainer(container.getName());
            pluginContainer.set(pc);
                       
            if (container.getDeployableContainer() instanceof RhqAgentPluginContainer) {
                rhqAgentPluginContainer.set((RhqAgentPluginContainer)container.getDeployableContainer());
            }
        } catch (Exception e) {
            throw new IllegalStateException("Could not switch to the PluginContainer '" + container.getName() + "'.", e);
        }
    }
View Full Code Here

    public static class StartCustomContainers {
        public void start(@Observes
        BeforeEnrichment event, ContainerRegistry registry) {
            System.out.println("*** IN START ");
            Container c = registry.getContainer("RHQAS7");
            try {
                if (!State.STARTED.equals(c.getState())) {
                    System.out.println("*** STARTING ");
                    c.start();
                } else {
                    System.out.println("*** SKIP START ");

                }
            } catch (Exception e) {
                System.err.println("Could not start custom container " + c.getName());
                e.printStackTrace();
            }
        }
View Full Code Here

    public static class CloseCustomContainers {
        public void stop(@Observes
        AfterSuite event, ContainerRegistry registry) {
            System.out.println("*** IN STOP ");
            Container c = registry.getContainer("RHQAS7");
            try {
                if (State.STARTED.equals(c.getState())) {
                    System.out.println("*** STOPPING ");
                    c.stop();
                }
            } catch (Exception e) {
                System.err.println("Could not stop custom container " + c.getName());
                e.printStackTrace();
            }
        }
View Full Code Here

      {
         return;
      }
      for(Deployment deployment: deployments)
      {
         Container container = containerRegistry.getContainer(deployment.getDescription().getTarget());
         operation.perform(container, deployment);
      }
   }
View Full Code Here

      String name = "some-name";
     
      ContainerRegistry registry = new LocalContainerRegistry(injector.get());
      registry.create(new ContainerDefImpl(ARQUILLIAN_XML).setContainerName(name), serviceLoader);
     
      Container container = registry.getContainer(TargetDescription.DEFAULT);
     
      Assert.assertEquals(
            "Verify that the only registered container is returned as default",
            name, container.getName());
   }
View Full Code Here

     
      ContainerRegistry registry = new LocalContainerRegistry(injector.get());
      registry.create(new ContainerDefImpl(ARQUILLIAN_XML).setContainerName("some-other-name"), serviceLoader);
      registry.create(new ContainerDefImpl(ARQUILLIAN_XML).setContainerName(name).setDefault(), serviceLoader);
     
      Container container = registry.getContainer(TargetDescription.DEFAULT);
     
      Assert.assertEquals(
            "Verify that the default registered container is returned as default",
            name, container.getName());
   }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.container.spi.Container

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.